Page History
...
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.
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
- Mask Editor
- Calibration Management Tool
- Detector Geometry
- CSPAD Alignment
- CSPAD2x2 Alignment
- Module ImgAlgos::NDArrCalib
...