Transform-CropToMask: crops image to the extremes of a bounding box about a given mask
See original GitHub issue🚀 Feature
Transform that crops given image to the extremes of a bounding box about a given mask.
Motivation
Such a transform is really useful in lung imaging for example, where we cut out the rest of the chest CT (which can include the unwanted abdomen) to crop to a lung segmentation that is fairly easy to acquire.
Pitch
A transform CropToMask
that takes mask_name
and a padding
variable and crops an input ScalarImage to the bounding box about mask_name
with padding to the crop bounding box.
If the padding value exceeds the limits of the ScalarImage then pad the output as provided by padding_mode
.
Alternatives
As suggested by @fepegar could also make this an implementation of CropOrPad
that takes target_shape=None
and mask_name
.
Additional context
Currently, I implement this by preprocessing my data separately. Example for lung mask in chest CT.
The CT images provided from QIN LUNG CT (https://wiki.cancerimagingarchive.net/display/Public/QIN+LUNG+CT#b8d88cce4fd14620bef4e5e35ec3d589) under Creative Commons Attribution 3.0 Unported License (https://creativecommons.org/licenses/by/3.0/). The citations are:
- Goldgof, Dmitry, Hall, Lawrence, Hawkins, Samuel, Schabath, Matthew, Stringfield, Olya, Garcia, Alberto, … Gillies, Robert. (2015). Data From QIN_LUNG_CT. The Cancer Imaging Archive. http://doi.org/10.7937/K9/TCIA.2015.NPGZYZBZ
- Jayashree Kalpathy-Cramer, Sandy Napel, Dmitry Goldgof, Binsheng Zhao. QIN multi-site collection of Lung CT data with Nodule Segmentations. http://dx.doi.org/10.7937/K9/TCIA.2015.1BUVFJR7
- Clark K, Vendt B, Smith K, Freymann J, Kirby J, Koppel P, Moore S, Phillips S, Maffitt D, Pringle M, Tarbox L, Prior F. The Cancer Imaging Archive (TCIA): Maintaining and Operating a Public Information Repository, Journal of Digital Imaging, Volume 26, Number 6, December, 2013, pp 1045-1057. (https://doi.org/10.1007/s10278-013-9622-7)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Yes, very good point, thank you. I’ll park it here for the future maybe 😃
Reopening after more interest has been shown on #677.