CorpusCallosum.transforms.localization¶
- class CorpusCallosum.transforms.localization.CropAroundACPCFixedSize(*args, **kwargs)[source]¶
Crop image around AC-PC points with fixed size.
A transform that crops the input image around the midpoint between AC and PC points with a fixed size window and optional random translation.
- Parameters:
- keys
list[str] Keys of the data dictionary to apply the transform to.
- fixed_size
tuple[int,int] Fixed size of the crop window (width, height).
- allow_missing_keys
bool,optional Whether to allow missing keys in the data dictionary, by default False.
- random_translate
int, default=0 Maximum random translation in voxels.
- keys
Methods
__call__(data)Apply the 2D crop 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.- Raises:
ValueErrorIf the crop boundaries extend outside the image dimensions.
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
- imagenp.ndarray
Input image to crop