clinicadl.transforms.extraction.Image

class clinicadl.transforms.extraction.Image[source]

Transform class for full image extraction, which is equivalent to no extraction.

Adds the following keys to the input DataPoint:

  • sample_type : "image"

  • sample_position: None

    Not relevant here. Only for consistency.

property sample_type: str

The type of the sample returned by this extraction, among {“image”, “slice”, “patch”}.

__call__(data_point: DataPointT, sample_index: int | None = None) DataPointT | Generator[DataPointT, None, None]

Extracts samples from a DataPoint object and returns a generator, or extracts a single sample and returns a DataPoint.

Samples are extracted from every images and masks in the input DataPoint.

Parameters:
  • data_point (DataPoint) – The images to perform extraction on.

  • sample_index (Optional[int], default=None) – Potential index indicating the sample to extract. If None, a generator of all the samples will be returned.

Returns:

Union[DataPoint, Generator[DataPoint, None, None]] – A new DataPoint, with the extracted sample, and some new information about the extraction (e.g., the sample position), or a generator of such DataPoints.

Raises:

IndexError – If sample_index is greater or equal to the number of samples in the image.

num_samples_per_image(data_point: DataPoint) int

Returns the number of samples that can be extracted from an image.

Parameters:

data_point (DataPoint) – The data containing the images to perform extraction on.

Returns:

int – The number of samples in the image.