-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transforms in CapsDataset #687
Transforms in CapsDataset #687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Thanks :)
transforms: Transforms, | ||
data: Optional[Union[pd.DataFrame, Path]] = None, | ||
caps_directory: Union[str, Path], | ||
preprocessing: Preprocessing, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can give a default preprocessing like PreprocessingT1()
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think T1 is the most common (at least in our lab).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
will look for masks with that values as a suffix. For example, if the image of the subject | ||
'sub-001' for the session 'ses-M000' is in 'sub-001/ses-M000/sub-001_ses-M000_T1w.nii.gz' | ||
and `masks=["brain", "hippocampus"]`, it will look for the masks in | ||
'sub-001/ses-M000/sub-001_ses-M000_brain.nii.gz' and 'sub-001/ses-M000/sub-001_ses-M000_hippocampus.nii.gz'. | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caps_directory = Path(caps_directory) # maybe to put in the CapsReader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is done in the CapsReader yes:
self.input_directory = Path(input_dir) |
Co-authored-by: camillebrianceau <[email protected]>
…dvx/clinicadl into caps_dataset_transforms
PR on
CapsDataset
,Preprocessing
andTransforms
.For
CapsDataset
:label
andmasks
arguments inCapsDataset
:label
can be eitherNone
(reconstruction), a mask (segmentation) or a column of the tsvdata
(classification, regression).masks
are masks that are potentially necessary to compute some transforms. Consequently, I added methods_get_masks
and_get_label
that are called in the__getitem__
.CapsDataset
's__getitem__
to handle TorchIO'sSubject
(following Continuing refactoring of the extraction objects #686).CapsDataset
class was growing pretty big, I tookcheck_preprocessing
andprepare_data
methods out of it.check_preprocessing
is now inCapsReader
; andprepare_data
is now a function that takes aCapsDataset
as an input.CapsDatasetSample
asCapsDataset
's__getitem__
now returns aSample
object (following Continuing refactoring of the extraction objects #686).For
Preprocessing
:BasePreprocessing
toPreprocessing
and the enumPreprocessing
toPreprocessingMethod
. The motivation is to havePreprocessing
in type hints.t2-linear
andt1-extensive
as they no longer exist.use_uncropped_image
forPreprocessingDTI
andPreprocessingCustom
as it is only an argument for linear pipelines.For
Transforms
:size_reduction
,size_reduction_factor
andnormalize
inTransforms
, as equivalent transforms can easily be passed.Transforms
object.Sorry for the huge PR. Besides, these are only suggestions, feel free to question them!