Skip to content

Commit

Permalink
Fix nipy#3654: corrected if statement for saving ROI and ROIs files
Browse files Browse the repository at this point in the history
  • Loading branch information
Oweda committed Jul 1, 2024
1 parent d91f6d2 commit b17ea54
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions nipype/interfaces/cat12/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
'rhe "Optimized Shooting - superlarge ventricles" option for "Spatial registration" is ! '
"required Values: \nnone: 0;\nlight: 1;\nfull: 2;\ndefault: 1070."
)
initial_segmentation = traits.Int(
0, field="extopts.spm_kamap", desc=_help_initial_seg, usedefault=True
)
# initial_segmentation = traits.Int(
# 0, field="extopts.spm_kamap", desc=_help_initial_seg, usedefault=True
# )

_help_las = (
"Additionally to WM-inhomogeneities, GM intensity can vary across different regions such as the motor"
Expand Down Expand Up @@ -231,10 +231,8 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
surface_measures = traits.Int(
1,
field="output.surf_measures",
# usedefault=True,
usedefault=True,
desc="Extract surface measures",
# requires=["neuromorphometrics", "lpba40", "cobra", "hammers", "thalamus", "thalamic_nuclei", "suit", "ibsr"],
# xor=["noROI"],
)

# Templates
Expand All @@ -243,64 +241,64 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
field="output.ROImenu.atlases.neuromorphometrics",
# usedefault=True,
desc="Extract brain measures for Neuromorphometrics template",
xor=["noROI"],
xor=["noROI"]
)
lpba40 = traits.Bool(
True,
field="output.ROImenu.atlases.lpba40",
# usedefault=True,
desc="Extract brain measures for LPBA40 template",
xor=["noROI"],
xor=["noROI"]
)
cobra = traits.Bool(
True,
field="output.ROImenu.atlases.hammers",
# usedefault=True,
desc="Extract brain measures for COBRA template",
xor=["noROI"],
xor=["noROI"]
)
hammers = traits.Bool(
False,
field="output.ROImenu.atlases.cobra",
# usedefault=True,
desc="Extract brain measures for Hammers template",
xor=["noROI"],
xor=["noROI"]
)
thalamus = traits.Bool(
True,
field="output.ROImenu.atlases.thalamus",
# usedefault=True,
desc="Extract brain measures for Thalamus template",
xor=["noROI"],
xor=["noROI"]
)
thalamic_nuclei = traits.Bool(
True,
field="output.ROImenu.atlases.thalamaic_nuclei",
field="output.ROImenu.atlases.thalamic_nuclei",
# usedefault=True,
desc="Extract brain measures for Thalamic Nuclei template",
xor=["noROI"],
xor=["noROI"]
)
suit = traits.Bool(
True,
field="output.ROImenu.atlases.suit",
# usedefault=True,
desc="Extract brain measures for Suit template",
xor=["noROI"],
xor=["noROI"]
)
ibsr = traits.Bool(
False,
field="output.ROImenu.atlases.ibsr",
# usedefault=True,
desc="Extract brain measures for IBSR template",
xor=["noROI"],
xor=["noROI"]
)
own_atlas = InputMultiPath(
ImageFileSPM(exists=True),
field="output.ROImenu.atlases.ownatlas",
desc="Extract brain measures for a given template",
mandatory=False,
copyfile=False,
xor=["noROI"],
xor=["noROI"]
)
noROI = traits.Bool(
field="output.ROImenu.noROI",
Expand Down Expand Up @@ -573,9 +571,10 @@ def _format_arg(self, opt, spec, val):
def _list_outputs(self):
outputs = self._outputs().get()
f = self.inputs.in_files[0]
pth, base, ext = split_filename(f)
if '.nii.gz' in f:
f = f[:-3]
pth, base, ext = split_filename(f)

outputs["mri_images"] = [
str(mri) for mri in Path(pth).glob("mri/*") if mri.is_file()
]
Expand Down Expand Up @@ -625,14 +624,17 @@ def _list_outputs(self):
outputs["label_files"] = [
str(label) for label in Path(pth).glob("label/*") if label.is_file()
]

if self.inputs.neuromorphometrics or self.inputs.lpba40 or self.inputs.cobra or self.inputs.hammers or self.inputs.thalamus or self.inputs.thalamic_nuclei or self.inputs.suit or self.inputs.ibsr:
outputs["label_roi"] = fname_presuffix(
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
)

if self.inputs.noROI:
if self.inputs.surface_and_thickness_estimation:
outputs["label_rois"] = fname_presuffix(
f, prefix=os.path.join("label", "catROIs_"), suffix=".xml", use_ext=False
)
outputs["label_roi"] = fname_presuffix(
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
)


return outputs

Expand Down

0 comments on commit b17ea54

Please sign in to comment.