Skip to content
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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
559040e
first draft fow new extraction objects
thibaultdvx Dec 9, 2024
3e7dc79
unittests
thibaultdvx Dec 10, 2024
016f61c
replace mentions of BaseExtraction
thibaultdvx Dec 10, 2024
6c5c81d
fix typing issue with Self
thibaultdvx Dec 10, 2024
a8e458a
update method calls in other modules
thibaultdvx Dec 10, 2024
810076b
add torchio subject support
thibaultdvx Dec 11, 2024
7e9209d
uniitest for torchio support
thibaultdvx Dec 11, 2024
8f1ba86
remove slice_mode
thibaultdvx Dec 11, 2024
7e711bc
add .clone()
thibaultdvx Dec 11, 2024
8bf0d54
typo in docstring
thibaultdvx Dec 11, 2024
d74a307
transform object
thibaultdvx Dec 12, 2024
4df6b40
change 'elem' to 'sample'
thibaultdvx Dec 12, 2024
1f27840
change eval() and train() so that they don't return anything
thibaultdvx Dec 12, 2024
5cf8933
add label, mask and torchio subject support in dataset
thibaultdvx Dec 12, 2024
5e319cd
prepare-data and check_preprocessing out of caps dataset
thibaultdvx Dec 16, 2024
b579022
preprocessing
thibaultdvx Dec 16, 2024
bb858eb
change mention of BasePreprocessing to Preprocessing
thibaultdvx Dec 16, 2024
6ad8d30
remove roi
thibaultdvx Dec 16, 2024
7b258ca
init in unittests
thibaultdvx Dec 16, 2024
0f358af
prepare-data outside caps_dataset
thibaultdvx Dec 16, 2024
c407d9f
change unittest accordingly
thibaultdvx Dec 16, 2024
034e4db
Merge remote-tracking branch 'upstream/clinicadl_v2' into clinicadl_v2
thibaultdvx Dec 17, 2024
1f90670
Merge branch 'clinicadl_v2' into caps_dataset_transforms
thibaultdvx Dec 17, 2024
87059ec
remove use_uncropped_image in DTI
thibaultdvx Dec 17, 2024
714e928
set use_uncropped_image to False
thibaultdvx Dec 17, 2024
30b340b
check if tsv file exists before writting it
thibaultdvx Dec 17, 2024
61458a0
modify transforms
thibaultdvx Dec 18, 2024
e650b57
Merge remote-tracking branch 'upstream/clinicadl_v2' into clinicadl_v2
thibaultdvx Dec 18, 2024
bac2315
Merge branch 'clinicadl_v2' into caps_dataset_transforms
thibaultdvx Dec 18, 2024
f431c7f
complete merge
thibaultdvx Dec 18, 2024
c3b8df9
use dictionnary
thibaultdvx Dec 18, 2024
6566a9c
path issue
thibaultdvx Dec 18, 2024
2561274
path issue
thibaultdvx Dec 18, 2024
3a3e0dd
path issue
thibaultdvx Dec 18, 2024
8b3c3b8
Update clinicadl/data/datasets/caps_dataset.py
thibaultdvx Dec 19, 2024
f18f5fe
default preprocessing in capsdataset
thibaultdvx Dec 19, 2024
08ddd12
Merge branch 'caps_dataset_transforms' of https://github.com/thibault…
thibaultdvx Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions clinicadl/data/config/data.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from logging import getLogger
from pathlib import Path
from typing import Any, Dict, Optional, Union
from typing import Dict, Optional, Union

import pandas as pd
from pydantic import field_validator

from clinicadl.utils.config import ClinicaDLConfig
from clinicadl.utils.exceptions import (
ClinicaDLArgumentError,
ClinicaDLTSVError,
)
from clinicadl.utils.exceptions import ClinicaDLTSVError

logger = getLogger("clinicadl.data_config")

Expand Down
14 changes: 8 additions & 6 deletions clinicadl/data/config/file_type.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from enum import Enum
from typing import Optional, Union

from pydantic import field_validator

from clinicadl.utils.config import ClinicaDLConfig
from clinicadl.utils.enum import Preprocessing
from clinicadl.utils.enum import PreprocessingMethod


class FileType(ClinicaDLConfig):
Expand All @@ -14,9 +13,10 @@ class FileType(ClinicaDLConfig):

pattern: str
description: str
needed_pipeline: Optional[Preprocessing] = None
needed_pipeline: Optional[PreprocessingMethod] = None

@field_validator("pattern", mode="before")
@classmethod
def check_pattern(cls, v):
if not v:
raise ValueError("A pattern must be specified")
Expand All @@ -30,18 +30,20 @@ def check_pattern(cls, v):
return v

@field_validator("description", mode="before")
@classmethod
def check_description(cls, v):
if not v:
raise ValueError("A description must be specified")
return v

@field_validator("needed_pipeline", mode="after")
def check_needed_pipeline(cls, v: Optional[Union[str, Preprocessing]]):
@classmethod
def check_needed_pipeline(cls, v: Optional[Union[str, PreprocessingMethod]]):
if v:
try:
v = Preprocessing(v)
v = PreprocessingMethod(v)
except ValueError:
raise ValueError(
f"Invalid pipeline: {v}. Choose from {[e.value for e in Preprocessing]}"
f"Invalid pipeline: {v}. Choose from {[e.value for e in PreprocessingMethod]}"
)
return v
Loading
Loading