clinicadl.data.structures.Sample

class clinicadl.data.structures.Sample(image: ScalarImage | Path | str, participant_id: str, session_id: str, file_type: BidsFileType | tuple[BidsFileType, ...], image_path: Path | tuple[Path, ...], sample_type: str | SampleType = SampleType.IMAGE, sample_position: int | tuple[int, int, int] | None = None, **kwargs: Any)[source]

The output of a Dataset.

It is a DataPoint, with additional attributes.

Attributes:
  • image (torchio.ScalarImage) – The image, in a torchio.ScalarImage.

  • participant_id (str) – The id of the participant_id.

  • session_id (str) – The id of the session.

  • file_type (tuple[BidsFileType, …]) – The BidsFileType. If they are multiple images in image (i.e. multiple channels), the BidsFileType of each of them is expected.

  • image_path (tuple[Path, …]) – The path to the image. If they are multiple images in image (i.e. multiple channels), the path of each of them is expected.

  • sample_type (str | SampleType) – The type of the sample, among {“image”, “slice”, “patch”}.

  • sample_position (Optional[Union[int, tuple[int, int, int]]]) – The position of the sample in the image if relevant, None otherwise.

    • If sample_type="slice": the index of the slice in the original image is expected.

    • If sample_type="patch": the position of the patch (i.e. the position of its upper left voxel) in the original image is expected.