# Database for ND ROIs
# Mark Rivers
# April 22, 2008

###################################################################
#  These records control the label for the ROI                    #
###################################################################
record(stringout, "$(P)$(R)Name")
{
   field(PINI, "1")
   field(DTYP, "asynOctetWrite")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))NAME")
}

record(stringin, "$(P)$(R)Name_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynOctetRead")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))NAME")
   field(SCAN, "I/O Intr")
}


###################################################################
#  These records control whether this ROI is used                 #
###################################################################
record(bo, "$(P)$(R)Use")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))USE")
   field(VAL,  "1")
   field(ZNAM, "No")
   field(ONAM, "Yes")
}

record(bi, "$(P)$(R)Use_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))USE")
   field(ZNAM, "No")
   field(ONAM, "Yes")
   field(SCAN, "I/O Intr")
}

###################################################################
#  These records control the ROI definition                       #
#  including binning, region start and size                       # 
###################################################################

record(longout, "$(P)$(R)BinX")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_BIN")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)BinX_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_BIN")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)BinY")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_BIN")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)BinY_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_BIN")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)BinZ")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_BIN")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)BinZ_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_BIN")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)MinX")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_MIN")
   field(VAL,  "0")
}

record(longin, "$(P)$(R)MinX_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_MIN")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)MinY")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_MIN")
   field(VAL,  "0")
}

record(longin, "$(P)$(R)MinY_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_MIN")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)MinZ")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_MIN")
   field(VAL,  "0")
}

record(longin, "$(P)$(R)MinZ_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_MIN")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)SizeX")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_SIZE")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)SizeX_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_SIZE")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)SizeY")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_SIZE")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)SizeY_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_SIZE")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)SizeZ")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_SIZE")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)SizeZ_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_SIZE")
   field(SCAN, "I/O Intr")
}

record(longin, "$(P)$(R)MaxSizeX_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_MAX_SIZE")
   field(SCAN, "I/O Intr")
}

record(longin, "$(P)$(R)MaxSizeY_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_MAX_SIZE")
   field(SCAN, "I/O Intr")
}

record(longin, "$(P)$(R)MaxSizeZ_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_MAX_SIZE")
   field(SCAN, "I/O Intr")
}

record(bo, "$(P)$(R)ReverseX")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_REVERSE")
   field(VAL,  "0")
   field(ZNAM, "No")
   field(ONAM, "Yes")
}

record(bi, "$(P)$(R)ReverseX_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM0_REVERSE")
   field(ZNAM, "No")
   field(ONAM, "Yes")
   field(SCAN, "I/O Intr")
}

record(bo, "$(P)$(R)ReverseY")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_REVERSE")
   field(VAL,  "0")
   field(ZNAM, "No")
   field(ONAM, "Yes")
}

record(bi, "$(P)$(R)ReverseY_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM1_REVERSE")
   field(ZNAM, "No")
   field(ONAM, "Yes")
   field(SCAN, "I/O Intr")
}

record(bo, "$(P)$(R)ReverseZ")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_REVERSE")
   field(VAL,  "0")
   field(ZNAM, "No")
   field(ONAM, "Yes")
}

record(bi, "$(P)$(R)ReverseZ_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DIM2_REVERSE")
   field(ZNAM, "No")
   field(ONAM, "Yes")
   field(SCAN, "I/O Intr")
}

record(longout, "$(P)$(R)BgdWidth")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))BGD_WIDTH")
   field(VAL,  "1")
}

record(longin, "$(P)$(R)BgdWidth_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))BGD_WIDTH")
   field(SCAN, "I/O Intr")
}

record(longin, "$(P)$(R)ImageSizeX_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))IMAGE_SIZE_X")
   field(SCAN, "I/O Intr")
}

record(longin, "$(P)$(R)ImageSizeY_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))IMAGE_SIZE_Y")
   field(SCAN, "I/O Intr")
}

record(longin, "$(P)$(R)ImageSizeZ_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))IMAGE_SIZE_Z")
   field(SCAN, "I/O Intr")
}

###################################################################
#  These records control the data type of the array data          # 
#  The last entry is "Automatic" meaning preserve the data type   #
#  of the input array.                                            # 
###################################################################

record(mbbo, "$(P)$(R)DataType")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DATA_TYPE")
   field(ZRST, "Int8")
   field(ZRVL, "0")
   field(ONST, "UInt8")
   field(ONVL, "1")
   field(TWST, "Int16")
   field(TWVL, "2")
   field(THST, "UInt16")
   field(THVL, "3")
   field(FRST, "Int32")
   field(FRVL, "4")
   field(FVST, "UInt32")
   field(FVVL, "5")
   field(SXST, "Float32")
   field(SXVL, "6")
   field(SVST, "Float64")
   field(SVVL, "7")
   field(EIST, "Automatic")
   field(EIVL, "-1")
}

record(mbbi, "$(P)$(R)DataType_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))DATA_TYPE")
   field(ZRST, "Int8")
   field(ZRVL, "0")
   field(ONST, "UInt8")
   field(ONVL, "1")
   field(TWST, "Int16")
   field(TWVL, "2")
   field(THST, "UInt16")
   field(THVL, "3")
   field(FRST, "Int32")
   field(FRVL, "4")
   field(FVST, "UInt32")
   field(FVVL, "5")
   field(SXST, "Float32")
   field(SXVL, "6")
   field(SVST, "Float64")
   field(SVVL, "7")
   field(EIST, "Automatic")
   field(EIVL, "-1")
   field(SCAN, "I/O Intr")
}


###################################################################
#  These records control whether statistics are computed          #
###################################################################
record(bo, "$(P)$(R)ComputeStatistics")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))COMPUTE_STATISTICS")
   field(VAL,  "1")
   field(ZNAM, "No")
   field(ONAM, "Yes")
}

record(bi, "$(P)$(R)ComputeStatistics_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))COMPUTE_STATISTICS")
   field(ZNAM, "No")
   field(ONAM, "Yes")
   field(SCAN, "I/O Intr")
}

###################################################################
#  These records contain the statistics for the ROI               #
###################################################################
record(ai, "$(P)$(R)MinValue_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))MIN_VALUE")
   field(SCAN, "I/O Intr")
}

record(ai, "$(P)$(R)MaxValue_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))MAX_VALUE")
   field(SCAN, "I/O Intr")
}

record(ai, "$(P)$(R)MeanValue_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))MEAN_VALUE")
   field(SCAN, "I/O Intr")
}
record(ai, "$(P)$(R)Total_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))TOTAL")
   field(SCAN, "I/O Intr")
}

record(ai, "$(P)$(R)Net_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))NET")
   field(SCAN, "I/O Intr")
}

###################################################################
#  These records control whether the histogram is computed        #
###################################################################
record(bo, "$(P)$(R)ComputeHistogram")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))COMPUTE_HISTOGRAM")
   field(VAL,  "1")
   field(ZNAM, "No")
   field(ONAM, "Yes")
}

record(bi, "$(P)$(R)ComputeHistogram_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))COMPUTE_HISTOGRAM")
   field(ZNAM, "No")
   field(ONAM, "Yes")
   field(SCAN, "I/O Intr")
}

###################################################################
#  These are used to define the histogram                         #
###################################################################
record(longout, "$(P)$(R)HistSize")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_SIZE")
   field(VAL,  "256")
}

record(longin, "$(P)$(R)HistSize_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynInt32")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_SIZE")
   field(SCAN, "I/O Intr")
}

record(ao, "$(P)$(R)HistMin")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_MIN")
   field(VAL,  "0")
}

record(ai, "$(P)$(R)HistMin_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_MIN")
   field(SCAN, "I/O Intr")
}

record(ao, "$(P)$(R)HistMax")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(OUT,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_MAX")
   field(VAL,  "255")
}

record(ai, "$(P)$(R)HistMax_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_MAX")
   field(SCAN, "I/O Intr")
}

record(ai, "$(P)$(R)HistEntropy_RBV")
{
   field(PINI, "1")
   field(DTYP, "asynFloat64")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_ENTROPY")
   field(PREC, "3")
   field(SCAN, "I/O Intr")
}

record(waveform, "$(P)$(R)Histogram_RBV")
{
   field(DTYP, "asynFloat64ArrayIn")
   field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))HIST_ARRAY")
   field(FTVL, "DOUBLE")
   field(NELM, "$(HIST_SIZE)")
   field(SCAN, "I/O Intr")
}


