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:
keyslist[str]

Keys of the data dictionary to apply the transform to.

fixed_sizetuple[int, int]

Fixed size of the crop window (width, height).

allow_missing_keysbool, optional

Whether to allow missing keys in the data dictionary, by default False.

random_translateint, default=0

Maximum random translation in voxels.

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), update data[key_transforms] and data[key_meta_dict] using the content from MetaTensor data[key], for MetaTensor backward compatibility 0.9.0.

first_key(data)

Get the first available key of self.keys in the input data dictionary.

key_iterator(data, *extra_iterables)

Iterate across keys and optionally extra iterables.

randomize(data)

Within this method, self.R should be used, instead of np.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.R instead of np.random to introduce random factors.

Raises:
ValueError

If 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