Skip to content

Commit

Permalink
Work on Perdsc pipeline (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
servoz committed Sep 12, 2024
1 parent 99cb483 commit 0e0b0eb
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 47 deletions.
20 changes: 10 additions & 10 deletions mia_processes/bricks/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def __init__(self):
"perf_normalisation",
traits.Any(
output=False,
optional=False,
optional=True,
desc=perf_normalisation_desc,
),
)
Expand All @@ -429,7 +429,7 @@ def __init__(self):
"zero_pad_fact",
traits.Int(
output=False,
optional=False,
optional=True,
desc=zero_pad_fact_desc,
),
)
Expand All @@ -455,7 +455,7 @@ def __init__(self):
"oscil_th",
traits.Float(
output=False,
optional=False,
optional=True,
desc=oscil_th_desc,
),
)
Expand All @@ -477,7 +477,7 @@ def __init__(self):
"bat_window_size",
traits.Int(
output=False,
optional=False,
optional=True,
desc=bat_window_size_desc,
),
)
Expand All @@ -500,7 +500,7 @@ def __init__(self):
"bat_th",
traits.Float(
output=False,
optional=False,
optional=True,
desc=bat_th_desc,
),
)
Expand Down Expand Up @@ -2915,7 +2915,7 @@ def __init__(self):
"bat_window_size",
traits.Int(
output=False,
optional=False,
optional=True,
desc=bat_window_size_desc,
),
)
Expand All @@ -2938,7 +2938,7 @@ def __init__(self):
"bat_th",
traits.Float(
output=False,
optional=False,
optional=True,
desc=bat_th_desc,
),
)
Expand All @@ -2948,7 +2948,7 @@ def __init__(self):
"wmaxr",
traits.Float(
output=False,
optional=False,
optional=True,
desc=wmaxr_desc,
),
)
Expand All @@ -2958,7 +2958,7 @@ def __init__(self):
"nb_vox_cand",
traits.Int(
output=False,
optional=False,
optional=True,
desc=nb_vox_cand_desc,
),
)
Expand All @@ -2968,7 +2968,7 @@ def __init__(self):
"nb_vox_best_scor",
traits.Int(
output=False,
optional=False,
optional=True,
desc=nb_vox_best_scor_desc,
),
)
Expand Down
104 changes: 67 additions & 37 deletions mia_processes/pipelines/Perfusion/perfdsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def pipeline_definition(self):

# nodes
self.add_process(
"1_spatial_preprocessing",
"spatial_preprocessing",
"mia_processes.pipelines.preprocess.bold_spatial_preprocessing1."
"Bold_spatial_preprocessing1",
)
self.nodes["1_spatial_preprocessing"].process.nodes_activation = {
self.nodes["spatial_preprocessing"].process.nodes_activation = {
"newsegment": True,
"realign": True,
"list_duplicate": True,
Expand All @@ -49,41 +49,41 @@ def pipeline_definition(self):
"coregister": True,
}
# We use exactly the same parameters as in Amigo.
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"realign"
].process.register_to_mean = False
# We can do the same with:
# self.nodes["1_spatial_preprocessing"].process.nodes[
# self.nodes["spatial_preprocessing"].process.nodes[
# "realign"].set_plug_value("register_to_mean", False)
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"normalize12_1"
].process.write_voxel_sizes = [1.0, 1.0, 1.0]
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"normalize12_1"
].process.write_bounding_box = [
[-78.0, -112.0, -50.0],
[78.0, 76.0, 85.0],
]
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"normalize12_1"
].process.write_interp = 1
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"normalize12_2"
].process.write_voxel_sizes = [2.0, 2.0, 2.0]
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"normalize12_2"
].process.write_bounding_box = [
[-78.0, -112.0, -50.0],
[78.0, 76.0, 85.0],
]
self.nodes["1_spatial_preprocessing"].process.nodes[
self.nodes["spatial_preprocessing"].process.nodes[
"normalize12_2"
].process.write_interp = 1
self.add_process(
"2_spatial_mask",
"spatial_mask",
"mia_processes.pipelines.preprocess.spatial_mask.Spatial_mask",
)
self.nodes["2_spatial_mask"].process.nodes_activation = {
self.nodes["spatial_mask"].process.nodes_activation = {
"gm_wm_normalize": True,
"threshold_1": True,
"smooth": True,
Expand All @@ -93,68 +93,98 @@ def pipeline_definition(self):
self.add_process(
"make_aif", "mia_processes.bricks.tools.tools.Make_AIF"
)
self.add_process(
"deconv_from_aif",
"mia_processes.bricks.tools.tools.Deconv_from_aif",
)

# links
self.export_parameter(
"1_spatial_preprocessing", "anat_file", is_optional=False
"spatial_preprocessing", "anat_file", is_optional=False
)
self.export_parameter(
"1_spatial_preprocessing", "func_files", is_optional=False
"spatial_preprocessing", "func_files", is_optional=False
)
self.add_link(
"1_spatial_preprocessing.native_class_images->"
"2_spatial_mask.native_class_images"
"spatial_preprocessing.native_class_images->"
"spatial_mask.native_class_images"
)
self.add_link(
"1_spatial_preprocessing.forward_deformation_field->"
"2_spatial_mask.deformation_file"
"spatial_preprocessing.forward_deformation_field->"
"spatial_mask.deformation_file"
)
self.add_link(
"1_spatial_preprocessing.smoothed_func->"
"2_spatial_mask.smoothed_func"
"spatial_preprocessing.smoothed_func->"
"spatial_mask.smoothed_func"
)
self.export_parameter(
"1_spatial_preprocessing",
"spatial_preprocessing",
"coregistered_source",
is_optional=False,
)
self.add_link(
"1_spatial_preprocessing.smoothed_func->" "make_aif.func_file"
"spatial_preprocessing.smoothed_func->make_aif.func_file"
)
self.add_link(
"spatial_preprocessing.smoothed_func->deconv_from_aif.func_file"
)
# Only done for normalize12_2 activation!
self.export_parameter(
"1_spatial_preprocessing", "normalized_anat", is_optional=False
"spatial_preprocessing", "normalized_anat", is_optional=False
)
self.add_link("spatial_mask.mask_003->deconv_from_aif.mask_file")
self.add_link("make_aif.aif_file->deconv_from_aif.aif_file")
self.export_parameter(
"deconv_from_aif", "CBV_image", is_optional=False
)
self.export_parameter(
"deconv_from_aif", "CBF_image", is_optional=False
)
self.export_parameter(
"deconv_from_aif", "MTT_image", is_optional=False
)
self.export_parameter(
"deconv_from_aif", "TTP_image", is_optional=False
)
self.export_parameter(
"deconv_from_aif", "Tmax_image", is_optional=False
)
self.export_parameter("2_spatial_mask", "mask_003", is_optional=False)
self.export_parameter("make_aif", "aif_file", is_optional=False)
self.export_parameter("deconv_from_aif", "T0_image", is_optional=False)

# parameters order
self.reorder_traits(
(
"mask_003",
"anat_file",
"func_files",
"normalized_anat",
"coregistered_source",
"aif_file",
"CBV_image",
"CBF_image",
"MTT_image",
"TTP_image",
"Tmax_image",
"T0_image",
)
)

# nodes positions
self.node_position = {
"1_spatial_preprocessing": (-369.0, -166.0),
"2_spatial_mask": (42.0, -76.0),
"outputs": (337.00279291855725, -76.0),
"inputs": (-548.5783216389599, -167.0),
"make_aif": (43.1492517677367, -270.66348836125746),
"spatial_preprocessing": (-197.948, -382.316),
"spatial_mask": (215.557, -349.799),
"make_aif": (93.192, 225.635),
"deconv_from_aif": (499.156, -27.223),
"outputs": (902.105, -79.388),
"inputs": (-474.037, -126.341),
}

# nodes dimensions
self.node_dimension = {
"1_spatial_preprocessing": (239.515625, 355.0),
"2_spatial_mask": (200.15625, 145.0),
"outputs": (135.8125, 110.0),
"inputs": (92.79751223929541, 110.0),
"make_aif": (117.0, 75.0),
"spatial_preprocessing": (236.515625, 355.0),
"spatial_mask": (200.15625, 145.0),
"outputs": (138.83679503946317, 236.0),
"inputs": (157.4225122392954, 286.0),
"make_aif": (172.171875, 250.0),
"deconv_from_aif_1": (215.328125, 320.0),
}

self.do_autoexport_nodes_parameters = False

0 comments on commit 0e0b0eb

Please sign in to comment.