Versions Compared

Key

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

...

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.

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 "Mask Editor". 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

...