Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Launching this app with -h option gives enough information about its functionality. In this note we demonstrate graphical content of the files generate in examples for this procedure. 

Command

sit_setup

roicon -h

print help message with detailed description of three commands, brief command examples, and the list of optional parameters:

...

by default converts the file  mask-roi.txt to mask-nda.txt. Algorithm uses sequential numeration of sensor pixels, shown by color in Fig.4 (left) with following mapping of pixel ROI mask content with ndarray,

Algorithm loops over pixel index ndarrays iX and iY and saves the mask-image status in the output ndarrsy:

Code Block
mask_nda = np.array( [mask_roi[r,c] for r,c in zip(iX, iY)] )

ROI mask content saved in the ndarray is presented in Fig.4 (right) in specific for CSPAD shape. As a cross-check this ndarray can be converted back to the image using geometry file, as shown in Fig.5.

Image RemovedImage Removed

 

Image Added 

Fig.43: Mask on the top of enumerated (color-coded) pixels (left) and result of the mask conversion to the ndarray (right).

 As a cross-check this ndarray can be converted back to the image using geometry file, as shown in Fig.4.

Fig.54: Cross-check: ndarray with mask is converted to the image using geometry file.

...

 

Code Block
[ImgAlgos.NDArrCalib] 
source = DetInfo(:Cspad.0) 
...
do_mask    = yes
fname_mask = mask-nda.txt

 

ROI mask for ndarray (or numpy array) can also be used in any stand-alone application, for example in python code. To apply the mask in python code the data numpy  array should be multiplied by the mask numpy array.

Examples

Mask for CSPAD2x2

Let us to produce mask for CSPAD2x2 with discarded edge, middle columns, unbounded pixels:

Code Block
cd <some-directory>
cp /reg/g/psdm/detector/alignment/cspad2x2/calib-cspad2x2-01-2013-02-13/calib/CsPad2x2::CalibV1/MecTargetChamber.0:Cspad2x2.1/geometry/0-end.data geo2x2.data
roicon -p1 -g geo2x2.data -c 15 -i mask-img.npy
roicon -p3 -g geo2x2.data -m mask-img.npy -n mask-nda.txt

Popping up monitoring images should be closed by pressing on (error) in the right window corner. This lets script to run until the end. Resulting file with CSPAD2x2 mask array in text format will be in the file mask-nda.txt (with 0/1 ordered the same way like in data of size 185*388*2 ). To check content use command:

Code Block
plims -v mask-nda.txt

where plims converts CSPAD2x2 (185,388,2) ndarray in naturally looking 2-d image adding extra-columns and rows in the middle.

 

Implementation of the ROI mask conversion algorithms in calibman

The same algorithms are implemented in the Calibration Management Tool  as a GUI under the tab "ROI". The files with ndarray and geometry constants should be selected as input parameters. The names of other intermediate output files are optional.  Three procedures for image reconstruction, mask editor, and mask conversion can be performed sequentially by clicking on relevant buttons. All files and images can be "Plot"-ted and "View"-ed. For now, mask file is saved in the work directory and is not deployed.  In stead, its path could be used in the ImgAlgos.NDArrCalib module.

References

...