CorpusCallosum.transforms.segmentation¶
- class CorpusCallosum.transforms.segmentation.CropAroundACPC(*args, **kwargs)[source]¶
Crop image around anterior and posterior commissure points.
A transform that crops the input image around the AC and PC points with optional padding and random translation.
- Parameters:
- keys
list[str] Keys of the data dictionary to apply the transform to.
- allow_missing_keys
bool, default=False Whether to allow missing keys in the data dictionary.
- padding_mm
float, default=10.0 Padding around AC-PC region in millimeters.
- random_translate
float, default=0 Maximum random translation in voxels, off by default.
- keys
Methods
__call__(data)Apply the transform to the data.
call_update(data)This function is to be called after every
self.__call__(data), updatedata[key_transforms]anddata[key_meta_dict]using the content from MetaTensordata[key], for MetaTensor backward compatibility 0.9.0.first_key(data)Get the first available key of
self.keysin the inputdatadictionary.key_iterator(data, *extra_iterables)Iterate across keys and optionally extra iterables.
randomize(data)Within this method,
self.Rshould be used, instead ofnp.random, to introduce random factors.set_random_state([seed, state])Set the random state locally, to control the randomness, the derived classes should use
self.Rinstead ofnp.randomto introduce random factors.Notes
The transform expects the following keys in the data dictionary:
- AC_centernp.ndarray
Coordinates of anterior commissure
- PC_centernp.ndarray
Coordinates of posterior commissure
- resfloat
Voxel resolution in mm
- class CorpusCallosum.transforms.segmentation.CropAroundACPCtrack(*args, **kwargs)[source]¶
Crop image around AC-PC points and update their coordinates.
Extends CropAroundACPC to also adjust the AC and PC center coordinates after cropping to maintain their correct positions in the cropped image.
- Parameters:
- keys
list[str] Keys of the data dictionary to apply the transform to.
- allow_missing_keys
bool,optional Whether to allow missing keys in the data dictionary, by default False.
- padding_mm
float,optional Padding around AC-PC region in millimeters, by default 10.
- random_translate
float,optional Maximum random translation in voxels, by default 0.
- keys
Methods
__call__(data)Apply the transform to the data.
call_update(data)This function is to be called after every
self.__call__(data), updatedata[key_transforms]anddata[key_meta_dict]using the content from MetaTensordata[key], for MetaTensor backward compatibility 0.9.0.first_key(data)Get the first available key of
self.keysin the inputdatadictionary.key_iterator(data, *extra_iterables)Iterate across keys and optionally extra iterables.
randomize(data)Within this method,
self.Rshould be used, instead ofnp.random, to introduce random factors.set_random_state([seed, state])Set the random state locally, to control the randomness, the derived classes should use
self.Rinstead ofnp.randomto introduce random factors.Notes
The transform expects the following keys in the data dictionary:
- AC_centernp.ndarray
Coordinates of anterior commissure
- PC_centernp.ndarray
Coordinates of posterior commissure
- AC_center_originalnp.ndarray
Original coordinates of anterior commissure
- PC_center_originalnp.ndarray
Original coordinates of posterior commissure