diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index d91c51f..ebd7b4a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -29,4 +29,4 @@ jobs: pip install ".[dev]" - name: Test with pytest run: | - pytest -sv --doctest-modules pydra/tasks/TODO + pytest -sv --doctest-modules pydra/tasks/sem diff --git a/MANIFEST.in b/MANIFEST.in index b3718cf..0be2b1f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include versioneer.py -include pydra/tasks/TODO/_version.py +include pydra/tasks/sem/_version.py diff --git a/pydra/tasks/TODO/__init__.py b/pydra/tasks/TODO/__init__.py deleted file mode 100644 index 35ee5f6..0000000 --- a/pydra/tasks/TODO/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -""" ->>> import pydra.tasks.TODO -""" -from ._version import get_versions - -__version__ = get_versions()["version"] -del get_versions diff --git a/pydra/tasks/sem/__init__.py b/pydra/tasks/sem/__init__.py new file mode 100644 index 0000000..93932a1 --- /dev/null +++ b/pydra/tasks/sem/__init__.py @@ -0,0 +1,30 @@ +from registration import * +from filtering import * +from segmentation import * +from utilities import * +from diffusion import * +from quantification import BRAINSLabelStats, PETStandardUptakeValueComputation +from brains import * +from testing import ( + CLIROITest, + ComputeReflectiveCorrelationMetric, + GenerateAverageLmkFile, + LandmarksCompare, +) +from converters import ( + CreateDICOMSeries, + DWICompare, + DWISimpleCompare, + OrientScalarVolume, +) +from legacy import * +from superresolution import GenerateEdgeMapImage +from classification import GeneratePurePlugMask +from surface import ( + GrayscaleModelMaker, + LabelMapSmoothing, + MergeModels, + ModelMaker, + ModelToLabelMap, + ProbeVolumeWithModel, +) diff --git a/pydra/tasks/TODO/_version.py b/pydra/tasks/sem/_version.py similarity index 99% rename from pydra/tasks/TODO/_version.py rename to pydra/tasks/sem/_version.py index 8aa63ef..b054446 100644 --- a/pydra/tasks/TODO/_version.py +++ b/pydra/tasks/sem/_version.py @@ -42,7 +42,7 @@ def get_config(): cfg.style = "pep440" cfg.tag_prefix = "" cfg.parentdir_prefix = "" - cfg.versionfile_source = "pydra/tasks/TODO/_version.py" + cfg.versionfile_source = "pydra/tasks/sem/_version.py" cfg.verbose = False return cfg diff --git a/pydra/tasks/sem/brains/__init__.py b/pydra/tasks/sem/brains/__init__.py new file mode 100644 index 0000000..6ff772d --- /dev/null +++ b/pydra/tasks/sem/brains/__init__.py @@ -0,0 +1,2 @@ +from classify import BRAINSPosteriorToContinuousClass +from segmentation import BRAINSTalairach, BRAINSTalairachMask diff --git a/pydra/tasks/sem/brains/classify.py b/pydra/tasks/sem/brains/classify.py new file mode 100644 index 0000000..d4a0db9 --- /dev/null +++ b/pydra/tasks/sem/brains/classify.py @@ -0,0 +1,141 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSPosteriorToContinuousClass: + """ + title: Tissue Classification + category: BRAINS.Classify + description: This program will generate an 8-bit continuous tissue classified image based on BRAINSABC posterior images. + version: 5.2.0 + documentation-url: http://www.nitrc.org/plugins/mwiki/index.php/brains:BRAINSClassify + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Vincent A. Magnotta + acknowledgements: Funding for this work was provided by NIH/NINDS award NS050568 + """ + + input_fields = [ + ( + "inputWhiteVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputWhiteVolume %s", + "help_string": "White Matter Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "inputBasalGmVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputBasalGmVolume %s", + "help_string": "Basal Grey Matter Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "inputSurfaceGmVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputSurfaceGmVolume %s", + "help_string": "Surface Grey Matter Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "inputCsfVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputCsfVolume %s", + "help_string": "CSF Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "inputVbVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVbVolume %s", + "help_string": "Venous Blood Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "inputCrblGmVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputCrblGmVolume %s", + "help_string": "Cerebellum Grey Matter Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "inputCrblWmVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputCrblWmVolume %s", + "help_string": "Cerebellum White Matter Posterior Volume", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Output Continuous Tissue Classified Image", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output Continuous Tissue Classified Image", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSPosteriorToContinuousClass", + executable=" BRAINSPosteriorToContinuousClass ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/brains/segmentation.py b/pydra/tasks/sem/brains/segmentation.py new file mode 100644 index 0000000..c93f19d --- /dev/null +++ b/pydra/tasks/sem/brains/segmentation.py @@ -0,0 +1,287 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSTalairach: + """ + title: BRAINS Talairach + category: BRAINS.Segmentation + description: This program creates a VTK structured grid defining the Talairach coordinate system based on four points: AC, PC, IRP, and SLA. The resulting structred grid can be written as either a classic VTK file or the new VTK XML file format. Two representations of the resulting grid can be written. The first is a bounding box representation that also contains the location of the AC and PC points. The second representation is the full Talairach grid representation that includes the additional rows of boxes added to the inferior allowing full coverage of the cerebellum. + version: 5.2.0 + documentation-url: http://www.nitrc.org/plugins/mwiki/index.php/brains:BRAINSTalairach + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Steven Dunn and Vincent Magnotta + acknowledgements: Funding for this work was provided by NIH/NINDS award NS050568 + """ + + input_fields = [ + ( + "AC", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--AC %s", + "help_string": "Location of AC Point ", + "sep": ",", + }, + ), + ), + ( + "ACisIndex", + attr.ib( + type=traits.Bool, + metadata={"argstr": "--ACisIndex ", "help_string": "AC Point is Index"}, + ), + ), + ( + "PC", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--PC %s", + "help_string": "Location of PC Point ", + "sep": ",", + }, + ), + ), + ( + "PCisIndex", + attr.ib( + type=traits.Bool, + metadata={"argstr": "--PCisIndex ", "help_string": "PC Point is Index"}, + ), + ), + ( + "SLA", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--SLA %s", + "help_string": "Location of SLA Point ", + "sep": ",", + }, + ), + ), + ( + "SLAisIndex", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--SLAisIndex ", + "help_string": "SLA Point is Index", + }, + ), + ), + ( + "IRP", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--IRP %s", + "help_string": "Location of IRP Point ", + "sep": ",", + }, + ), + ), + ( + "IRPisIndex", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--IRPisIndex ", + "help_string": "IRP Point is Index", + }, + ), + ), + ( + "inputLandmarksFile", + attr.ib( + type=File, + metadata={ + "argstr": "--inputLandmarksFile %s", + "help_string": "input landmarks file: *.fcsv", + "exists": "True", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Input image used to define physical space of images", + "exists": "True", + }, + ), + ), + ( + "outputBox", + attr.ib( + type=File, + metadata={ + "argstr": "--outputBox %s", + "help_string": "Name of the resulting Talairach Bounding Box file", + "hash_files": "False", + }, + ), + ), + ( + "outputGrid", + attr.ib( + type=File, + metadata={ + "argstr": "--outputGrid %s", + "help_string": "Name of the resulting Talairach Grid file", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputBox", + attr.ib( + type=File, + metadata={ + "help_string": "Name of the resulting Talairach Bounding Box file", + "exists": "True", + }, + ), + ), + ( + "outputGrid", + attr.ib( + type=File, + metadata={ + "help_string": "Name of the resulting Talairach Grid file", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSTalairach", + executable=" BRAINSTalairach ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSTalairachMask: + """ + title: Talairach Mask + category: BRAINS.Segmentation + description: This program creates a binary image representing the specified Talairach region. The input is an example image to define the physical space for the resulting image, the Talairach grid representation in VTK format, and the file containing the Talairach box definitions to be generated. These can be combined in BRAINS to create a label map using the procedure Brains::WorkupUtils::CreateLabelMapFromBinaryImages. + version: 5.2.0 + documentation-url: http://www.nitrc.org/plugins/mwiki/index.php/brains:BRAINSTalairachMask + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Steven Dunn and Vincent Magnotta + acknowledgements: Funding for this work was provided by NIH/NINDS award NS050568 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Input image used to define physical space of resulting mask", + "exists": "True", + }, + ), + ), + ( + "talairachParameters", + attr.ib( + type=File, + metadata={ + "argstr": "--talairachParameters %s", + "help_string": "Name of the Talairach parameter file.", + "exists": "True", + }, + ), + ), + ( + "talairachBox", + attr.ib( + type=File, + metadata={ + "argstr": "--talairachBox %s", + "help_string": "Name of the Talairach box file.", + "exists": "True", + }, + ), + ), + ( + "hemisphereMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--hemisphereMode %s", + "help_string": "Mode for box creation: left, right, both", + }, + ), + ), + ( + "expand", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--expand ", + "help_string": "Expand exterior box to include surface CSF", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Output filename for the resulting binary image", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filename for the resulting binary image", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSTalairachMask", + executable=" BRAINSTalairachMask ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/classification.py b/pydra/tasks/sem/classification.py new file mode 100644 index 0000000..32fd1d6 --- /dev/null +++ b/pydra/tasks/sem/classification.py @@ -0,0 +1,102 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class GeneratePurePlugMask: + """ + title: Pure Plugs Mask + category: Classification + description: This program gets several modality image files and returns a binary mask that defines the pure plugs. + version: 5.2.0 + contributor: Ali Ghayoor + """ + + input_fields = [ + ( + "inputImageModalities", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputImageModalities %s...", + "help_string": "Input image files names (.nii.gz or .nrrd)", + }, + ), + ), + ( + "threshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--threshold %f", + "help_string": "threshold value to define class membership.", + }, + ), + ), + ( + "numberOfSubSamples", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--numberOfSubSamples %s", + "help_string": "Number of continous index samples taken at each direction of lattice space for each plug volume.", + "sep": ",", + }, + ), + ), + ( + "verbose", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--verbose ", + "help_string": "Print out some debugging information.", + }, + ), + ), + ( + "outputMaskFile", + attr.ib( + type=File, + metadata={ + "argstr": "--outputMaskFile %s", + "help_string": "Ouput binary mask that includes the pure plugs (.nrrd)", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputMaskFile", + attr.ib( + type=File, + metadata={ + "help_string": "Ouput binary mask that includes the pure plugs (.nrrd)", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GeneratePurePlugMask", + executable=" GeneratePurePlugMask ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/converters.py b/pydra/tasks/sem/converters.py new file mode 100644 index 0000000..6cf4868 --- /dev/null +++ b/pydra/tasks/sem/converters.py @@ -0,0 +1,552 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class CreateDICOMSeries: + """ + title: Create a DICOM Series + category: Converters + description: Create a DICOM Series from a Slicer volume. User can specify values for selected DICOM tags in the UI. Given the number of tags DICOM series have, it is impossible to expose all tags in UI. So only important tags can be set by the user. + version: 0.1.0.$Revision$(alpha) + documentation-url: https://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/CreateDICOMSeries + contributor: Bill Lorensen (GE) + acknowledgements: This command module was derived from Insight/Examples (copyright) Insight Software Consortium + """ + + input_fields = [ + ( + "patientName", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--patientName %s", + "help_string": "The name of the patient (0010,0010)", + }, + ), + ), + ( + "patientID", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--patientID %s", + "help_string": "The patient ID (0010,0020)", + }, + ), + ), + ( + "patientBirthDate", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--patientBirthDate %s", + "help_string": "Patient birth date (0010,0030)", + }, + ), + ), + ( + "patientSex", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--patientSex %s", + "help_string": "Patient sex (0010,0040)", + }, + ), + ), + ( + "patientComments", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--patientComments %s", + "help_string": "Patient comments (0010,4000)", + }, + ), + ), + ( + "studyID", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--studyID %s", + "help_string": "The study ID (0020,0010)", + }, + ), + ), + ( + "studyDate", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--studyDate %s", + "help_string": "The date of the study (0008,0020)", + }, + ), + ), + ( + "studyTime", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--studyTime %s", + "help_string": "The time of the study (0008,0030)", + }, + ), + ), + ( + "studyComments", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--studyComments %s", + "help_string": "Study comments (0032,4000)", + }, + ), + ), + ( + "studyDescription", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--studyDescription %s", + "help_string": "Study description (0008,1030)", + }, + ), + ), + ( + "modality", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--modality %s", + "help_string": "Modality (0008,0060)", + }, + ), + ), + ( + "manufacturer", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--manufacturer %s", + "help_string": "Manufacturer (0008,0070)", + }, + ), + ), + ( + "model", + attr.ib( + type=traits.Str, + metadata={"argstr": "--model %s", "help_string": "model (0008,1090)"}, + ), + ), + ( + "seriesNumber", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--seriesNumber %s", + "help_string": "The series number (0020,0011)", + }, + ), + ), + ( + "seriesDescription", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--seriesDescription %s", + "help_string": "Series description (0008,103E)", + }, + ), + ), + ( + "seriesDate", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--seriesDate %s", + "help_string": "The date of the series (0008,0021)", + }, + ), + ), + ( + "seriesTime", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--seriesTime %s", + "help_string": "The time of the series (0008,0031)", + }, + ), + ), + ( + "rescaleIntercept", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rescaleIntercept %f", + "help_string": "Rescale interscept (0028,1052). Converts pixel values on disk to pixel values in memory. (Pixel value in memory) = (Pixel value on disk) * rescaleSlope + rescaleIntercept. Default is 0.0. Data values are converted on write (the data is scaled and shifted so that the slope and interscept will bring it back to the current intensity range).", + }, + ), + ), + ( + "rescaleSlope", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rescaleSlope %f", + "help_string": "Rescale slope (0028,1053). Converts pixel values on disk to pixel values in memory. (Pixel value in memory) = (Pixel value on disk) * rescaleSlope + rescaleInterscept. Default is 1.0. Data values are converted on write (the data is scaled and shifted so that the slope and interscept will bring it back to the current intensity range).", + }, + ), + ), + ( + "contentDate", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--contentDate %s", + "help_string": "The date of the image content (0008,0023)", + }, + ), + ), + ( + "contentTime", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--contentTime %s", + "help_string": "The time of the image content (0008,0033)", + }, + ), + ), + ( + "studyInstanceUID", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--studyInstanceUID %s", + "help_string": "The study instance UID (0020,000d)", + }, + ), + ), + ( + "seriesInstanceUID", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--seriesInstanceUID %s", + "help_string": "The series instance UID (0020,000e)", + }, + ), + ), + ( + "frameOfReferenceInstanceUID", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--frameOfReferenceInstanceUID %s", + "help_string": "The frame of reference instance UID (0020,0052)", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be resampled", + "position": "-1", + "exists": "True", + }, + ), + ), + ( + "dicomDirectory", + attr.ib( + type=Directory, + metadata={ + "argstr": "--dicomDirectory %s", + "help_string": "The directory to contain the DICOM series.", + "hash_files": "False", + }, + ), + ), + ( + "dicomPrefix", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--dicomPrefix %s", + "help_string": "The prefix of the DICOM filename.", + }, + ), + ), + ( + "dicomNumberFormat", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--dicomNumberFormat %s", + "help_string": "The printf-style format to be used when creating the per-slice DICOM filename.", + }, + ), + ), + ( + "reverseImages", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--reverseImages ", + "help_string": "Reverse the slices.", + }, + ), + ), + ( + "useCompression", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useCompression ", + "help_string": "Compress the output pixel data.", + }, + ), + ), + ( + "type", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--type %s", + "help_string": "Type for the new output volume.", + }, + ), + ), + ] + output_fields = [ + ( + "dicomDirectory", + attr.ib( + type=Directory, + metadata={ + "help_string": "The directory to contain the DICOM series.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="CreateDICOMSeries", + executable=" CreateDICOMSeries ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class DWICompare: + """ + title: Nrrd DWI comparison + category: Converters + description: Compares two nrrd format DWI images and verifies that gradient magnitudes, gradient directions, measurement frame, and max B0 value are identicle. Used for testing DWIConvert. + version: 5.2.0 + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/DWIConvert + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Mark Scully (UIowa) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. Additional support for DTI data produced on Philips scanners was contributed by Vincent Magnotta and Hans Johnson at the University of Iowa. + """ + + input_fields = [ + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume1 %s", + "help_string": "First input volume (.nhdr or .nrrd)", + "exists": "True", + }, + ), + ), + ( + "inputVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume2 %s", + "help_string": "Second input volume (.nhdr or .nrrd)", + "exists": "True", + }, + ), + ), + ( + "useIdentityMeasurementFrame", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useIdentityMeasurementFrame ", + "help_string": "Do comparisons with identity mesasurement frames", + }, + ), + ), + ] + output_fields = [] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="DWICompare", + executable=" DWICompare ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class DWISimpleCompare: + """ + title: Nrrd DWI comparison + category: Converters + description: Compares two nrrd format DWI images and verifies that gradient magnitudes, gradient directions, measurement frame, and max B0 value are identicle. Used for testing DWIConvert. + version: 5.2.0 + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/DWIConvert + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Mark Scully (UIowa) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. Additional support for DTI data produced on Philips scanners was contributed by Vincent Magnotta and Hans Johnson at the University of Iowa. + """ + + input_fields = [ + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume1 %s", + "help_string": "First input volume (.nhdr or .nrrd)", + "exists": "True", + }, + ), + ), + ( + "inputVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume2 %s", + "help_string": "Second input volume (.nhdr or .nrrd)", + "exists": "True", + }, + ), + ), + ( + "checkDWIData", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--checkDWIData ", + "help_string": "check for existence of DWI data, and if present, compare it", + }, + ), + ), + ] + output_fields = [] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="DWISimpleCompare", + executable=" DWISimpleCompare ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class OrientScalarVolume: + """ + title: Orient Scalar Volume + category: Converters + description: Orients an output volume. Rearranges the slices in a volume according to the selected orientation. The slices are not interpolated. They are just reordered and/or permuted. The resulting volume will cover the original volume. NOTE: since Slicer takes into account the orientation of a volume, the re-oriented volume will not show any difference from the original volume, To see the difference, save the volume and display it with a system that either ignores the orientation of the image (e.g. Paraview) or displays individual images. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/OrientImage + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 1", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "The oriented volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "orientation", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--orientation %s", + "help_string": "Orientation choices", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "The oriented volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="OrientScalarVolume", + executable=" OrientScalarVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/diffusion/__init__.py b/pydra/tasks/sem/diffusion/__init__.py new file mode 100644 index 0000000..9ed5999 --- /dev/null +++ b/pydra/tasks/sem/diffusion/__init__.py @@ -0,0 +1,33 @@ +from utilities import BRAINSDWICleanup, ResampleDTIVolume +from gtract import ( + compareTractInclusion, + extractNrrdVectorIndex, + gtractAnisotropyMap, + gtractAverageBvalues, + gtractClipAnisotropy, + gtractCoRegAnatomy, + gtractCoRegAnatomyBspline, + gtractCoRegAnatomyRigid, + gtractConcatDwi, + gtractCopyImageOrientation, + gtractCoregBvalues, + gtractCostFastMarching, + gtractCreateGuideFiber, + gtractFastMarchingTracking, + gtractFiberTracking, + gtractFreeTracking, + gtractGraphSearchTracking, + gtractGuidedTracking, + gtractImageConformity, + gtractInvertBSplineTransform, + gtractInvertDisplacementField, + gtractInvertRigidTransform, + gtractResampleAnisotropy, + gtractResampleB0, + gtractResampleCodeImage, + gtractResampleDWIInPlace, + gtractResampleFibers, + gtractStreamlineTracking, + gtractTensor, + gtractTransformToDisplacementField, +) diff --git a/pydra/tasks/sem/diffusion/gtract.py b/pydra/tasks/sem/diffusion/gtract.py new file mode 100644 index 0000000..e2046ef --- /dev/null +++ b/pydra/tasks/sem/diffusion/gtract.py @@ -0,0 +1,4302 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class compareTractInclusion: + """ + title: Compare Tracts + category: Diffusion.GTRACT + description: This program will halt with a status code indicating whether a test tract is nearly enough included in a standard tract in the sense that every fiber in the test tract has a low enough sum of squares distance to some fiber in the standard tract modulo spline resampling of every fiber to a fixed number of points. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "testFiber", + attr.ib( + type=File, + metadata={ + "argstr": "--testFiber %s", + "help_string": "Required: test fiber tract file name", + "exists": "True", + }, + ), + ), + ( + "standardFiber", + attr.ib( + type=File, + metadata={ + "argstr": "--standardFiber %s", + "help_string": "Required: standard fiber tract file name", + "exists": "True", + }, + ), + ), + ( + "closeness", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--closeness %f", + "help_string": "Closeness of every test fiber to some fiber in the standard tract, computed as a sum of squares of spatial differences of standard points", + }, + ), + ), + ( + "numberOfPoints", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfPoints %d", + "help_string": "Number of points in comparison fiber pairs", + }, + ), + ), + ( + "testForBijection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--testForBijection ", + "help_string": "Flag to apply the closeness criterion both ways", + }, + ), + ), + ( + "testForFiberCardinality", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--testForFiberCardinality ", + "help_string": "Flag to require the same number of fibers in both tracts", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of XML files when reading and writing vtkPolyData.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="compareTractInclusion", + executable=" compareTractInclusion ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class extractNrrdVectorIndex: + """ + title: Extract Nrrd Index + category: Diffusion.GTRACT + description: This program will extract a 3D image (single vector) from a vector 3D image at a given vector index. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input file containing the vector that will be extracted", + "exists": "True", + }, + ), + ), + ( + "vectorIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--vectorIndex %d", + "help_string": "Index in the vector image to extract", + }, + ), + ), + ( + "setImageOrientation", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--setImageOrientation %s", + "help_string": "Sets the image orientation of the extracted vector (Axial, Coronal, Sagittal)", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the vector image at the given index", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the vector image at the given index", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="extractNrrdVectorIndex", + executable=" extractNrrdVectorIndex ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractAnisotropyMap: + """ + title: Anisotropy Map + category: Diffusion.GTRACT + description: This program will generate a scalar map of anisotropy, given a tensor representation. Anisotropy images are used for fiber tracking, but the anisotropy scalars are not defined along the path. Instead, the tensor representation is included as point data allowing all of these metrics to be computed using only the fiber tract point data. The images can be saved in any ITK supported format, but it is suggested that you use an image format that supports the definition of the image origin. This includes NRRD, NifTI, and Meta formats. These images can also be used for scalar analysis including regional anisotropy measures or VBM style analysis. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input file containing the diffusion tensor image", + "exists": "True", + }, + ), + ), + ( + "anisotropyType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--anisotropyType %s", + "help_string": "Anisotropy Mapping Type: ADC, FA, RA, VR, AD, RD, LI", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the selected kind of anisotropy scalar.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the selected kind of anisotropy scalar.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractAnisotropyMap", + executable=" gtractAnisotropyMap ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractAverageBvalues: + """ + title: Average B-Values + category: Diffusion.GTRACT + description: This program will directly average together the baseline gradients (b value equals 0) within a DWI scan. This is usually used after gtractCoregBvalues. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input image file name containing multiple baseline gradients to average", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing directly averaged baseline images", + "hash_files": "False", + }, + ), + ), + ( + "directionsTolerance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--directionsTolerance %f", + "help_string": "Tolerance for matching identical gradient direction pairs", + }, + ), + ), + ( + "averageB0only", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--averageB0only ", + "help_string": "Average only baseline gradients. All other gradient directions are not averaged, but retained in the outputVolume", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing directly averaged baseline images", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractAverageBvalues", + executable=" gtractAverageBvalues ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractClipAnisotropy: + """ + title: Clip Anisotropy + category: Diffusion.GTRACT + description: This program will zero the first and/or last slice of an anisotropy image, creating a clipped anisotropy image. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input image file name", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the clipped anisotropy image", + "hash_files": "False", + }, + ), + ), + ( + "clipFirstSlice", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--clipFirstSlice ", + "help_string": "Clip the first slice of the anisotropy image", + }, + ), + ), + ( + "clipLastSlice", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--clipLastSlice ", + "help_string": "Clip the last slice of the anisotropy image", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the clipped anisotropy image", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractClipAnisotropy", + executable=" gtractClipAnisotropy ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCoRegAnatomy: + """ + title: Coregister B0 to Anatomy B-Spline + category: Diffusion.GTRACT + description: This program will register a Nrrd diffusion weighted 4D vector image to a fixed anatomical image. Two registration methods are supported for alignment with anatomical images: Rigid and B-Spline. The rigid registration performs a rigid body registration with the anatomical images and should be done as well to initialize the B-Spline transform. The B-SPline transform is the deformable transform, where the user can control the amount of deformation based on the number of control points as well as the maximum distance that these points can move. The B-Spline registration places a low dimensional grid in the image, which is deformed. This allows for some susceptibility related distortions to be removed from the diffusion weighted images. In general the amount of motion in the slice selection and read-out directions direction should be kept low. The distortion is in the phase encoding direction in the images. It is recommended that skull stripped (i.e. image containing only brain with skull removed) images shoud be used for image co-registration with the B-Spline transform. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input vector image file name. It is recommended that the input volume is the skull stripped baseline image of the DWI scan.", + "exists": "True", + }, + ), + ), + ( + "inputAnatomicalVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnatomicalVolume %s", + "help_string": "Required: input anatomical image file name. It is recommended that that the input anatomical image has been skull stripped and has the same orientation as the DWI scan.", + "exists": "True", + }, + ), + ), + ( + "vectorIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--vectorIndex %d", + "help_string": "Vector image index in the moving image (within the DWI) to be used for registration.", + }, + ), + ), + ( + "inputRigidTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputRigidTransform %s", + "help_string": "Required (for B-Spline type co-registration): input rigid transform file name. Used as a starting point for the anatomical B-Spline registration.", + "exists": "True", + }, + ), + ), + ( + "outputTransformName", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransformName %s", + "help_string": "Required: filename for the fit transform.", + "hash_files": "False", + }, + ), + ), + ( + "transformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transformType %s", + "help_string": "Transform Type: Rigid|Bspline", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfIterations %d", + "help_string": "Number of iterations in the selected 3D fit", + }, + ), + ), + ( + "gridSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--gridSize %s", + "help_string": "Number of grid subdivisions in all 3 directions", + "sep": ",", + }, + ), + ), + ( + "borderSize", + attr.ib( + type=traits.Int, + metadata={"argstr": "--borderSize %d", "help_string": "Size of border"}, + ), + ), + ( + "numberOfHistogramBins", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfHistogramBins %d", + "help_string": "Number of histogram bins", + }, + ), + ), + ( + "spatialScale", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--spatialScale %d", + "help_string": "Scales the number of voxels in the image by this value to specify the number of voxels used in the registration", + }, + ), + ), + ( + "convergence", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--convergence %f", + "help_string": "Convergence Factor", + }, + ), + ), + ( + "gradientTolerance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--gradientTolerance %f", + "help_string": "Gradient Tolerance", + }, + ), + ), + ( + "maxBSplineDisplacement", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maxBSplineDisplacement %f", + "help_string": " Sets the maximum allowed displacements in image physical coordinates for BSpline control grid along each axis. A value of 0.0 indicates that the problem should be unbounded. NOTE: This only constrains the BSpline portion, and does not limit the displacement from the associated bulk transform. This can lead to a substantial reduction in computation time in the BSpline optimizer., ", + }, + ), + ), + ( + "maximumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumStepSize %f", + "help_string": "Maximum permitted step size to move in the selected 3D fit", + }, + ), + ), + ( + "minimumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumStepSize %f", + "help_string": "Minimum required step size to move in the selected 3D fit without converging -- decrease this to make the fit more exacting", + }, + ), + ), + ( + "translationScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--translationScale %f", + "help_string": "How much to scale up changes in position compared to unit rotational changes in radians -- decrease this to put more translation in the fit", + }, + ), + ), + ( + "relaxationFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--relaxationFactor %f", + "help_string": "Fraction of gradient from Jacobian to attempt to move in the selected 3D fit", + }, + ), + ), + ( + "numberOfSamples", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfSamples %d", + "help_string": "The number of voxels sampled for mutual information computation. Increase this for a slower, more careful fit. NOTE that it is suggested to use samplingPercentage instead of this option. However, if set, it overwrites the samplingPercentage option. ", + }, + ), + ), + ( + "samplingPercentage", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--samplingPercentage %f", + "help_string": "This is a number in (0.0,1.0] interval that shows the percentage of the input fixed image voxels that are sampled for mutual information computation. Increase this for a slower, more careful fit. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation. The default is to use approximately 5% of voxels (for backwards compatibility 5% ~= 500000/(256*256*256)). Typical values range from 1% for low detail images to 20% for high detail images.", + }, + ), + ), + ( + "useMomentsAlign", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useMomentsAlign ", + "help_string": "MomentsAlign assumes that the center of mass of the images represent similar structures. Perform a MomentsAlign registration as part of the sequential registration steps. This option MUST come first, and CAN NOT be used with either CenterOfHeadLAlign, GeometryAlign, or initialTransform file. This family of options superceeds the use of transformType if any of them are set.", + }, + ), + ), + ( + "useGeometryAlign", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useGeometryAlign ", + "help_string": "GeometryAlign on assumes that the center of the voxel lattice of the images represent similar structures. Perform a GeometryCenterAlign registration as part of the sequential registration steps. This option MUST come first, and CAN NOT be used with either MomentsAlign, CenterOfHeadAlign, or initialTransform file. This family of options superceeds the use of transformType if any of them are set.", + }, + ), + ), + ( + "useCenterOfHeadAlign", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useCenterOfHeadAlign ", + "help_string": "CenterOfHeadAlign attempts to find a hemisphere full of foreground voxels from the superior direction as an estimate of where the center of a head shape would be to drive a center of mass estimate. Perform a CenterOfHeadAlign registration as part of the sequential registration steps. This option MUST come first, and CAN NOT be used with either MomentsAlign, GeometryAlign, or initialTransform file. This family of options superceeds the use of transformType if any of them are set.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputTransformName", + attr.ib( + type=File, + metadata={ + "help_string": "Required: filename for the fit transform.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCoRegAnatomy", + executable=" gtractCoRegAnatomy ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCoRegAnatomyBspline: + """ + title: Coregister B0 to Anatomy B-Spline + category: Diffusion.GTRACT + description: This program will register a NRRD diffusion weighted 4D vector image to a fixed anatomical image to produce a Bspline fit. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input vector image file name. It is recommended that the input volume is the skull stripped baseline image of the DWI scan.", + "exists": "True", + }, + ), + ), + ( + "inputAnatomicalVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnatomicalVolume %s", + "help_string": "Required: input anatomical image file name. It is recommended that that the input anatomical image has been skull stripped and has the same orientation as the DWI scan.", + "exists": "True", + }, + ), + ), + ( + "vectorIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--vectorIndex %d", + "help_string": "Vector image index in the moving image (within the DWI) to be used for registration.", + }, + ), + ), + ( + "inputRigidTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputRigidTransform %s", + "help_string": "Required (for B-Spline type co-registration): input rigid transform file name. Used as a starting point for the anatomical B-Spline registration.", + "exists": "True", + }, + ), + ), + ( + "outputBsplineTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputBsplineTransform %s", + "help_string": "Required: filename for the B-Spline fit transform.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfIterations %d", + "help_string": "Number of iterations in the selected 3D fit", + }, + ), + ), + ( + "gridSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--gridSize %s", + "help_string": "Number of grid subdivisions in all 3 directions", + "sep": ",", + }, + ), + ), + ( + "borderSize", + attr.ib( + type=traits.Int, + metadata={"argstr": "--borderSize %d", "help_string": "Size of border"}, + ), + ), + ( + "numberOfHistogramBins", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfHistogramBins %d", + "help_string": "Number of histogram bins", + }, + ), + ), + ( + "spatialScale", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--spatialScale %d", + "help_string": "Scales the number of voxels in the image by this value to specify the number of voxels used in the registration", + }, + ), + ), + ( + "convergence", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--convergence %f", + "help_string": "Convergence Factor", + }, + ), + ), + ( + "gradientTolerance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--gradientTolerance %f", + "help_string": "Gradient Tolerance", + }, + ), + ), + ( + "maxBSplineDisplacement", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maxBSplineDisplacement %f", + "help_string": " Sets the maximum allowed displacements in image physical coordinates for BSpline control grid along each axis. A value of 0.0 indicates that the problem should be unbounded. NOTE: This only constrains the BSpline portion, and does not limit the displacement from the associated bulk transform. This can lead to a substantial reduction in computation time in the BSpline optimizer., ", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputBsplineTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Required: filename for the B-Spline fit transform.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCoRegAnatomyBspline", + executable=" gtractCoRegAnatomyBspline ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCoRegAnatomyRigid: + """ + title: Coregister B0 to Anatomy Rigid + category: Diffusion.GTRACT + description: This program will register a NRRD diffusion weighted 4D vector image to a fixed anatomical image to produce a rigid fit. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input vector image file name. It is recommended that the input volume is the skull stripped baseline image of the DWI scan.", + "exists": "True", + }, + ), + ), + ( + "inputAnatomicalVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnatomicalVolume %s", + "help_string": "Required: input anatomical image file name. It is recommended that that the input anatomical image has been skull stripped and has the same orientation as the DWI scan.", + "exists": "True", + }, + ), + ), + ( + "vectorIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--vectorIndex %d", + "help_string": "Vector image index in the moving image (within the DWI) to be used for registration.", + }, + ), + ), + ( + "outputRigidTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputRigidTransform %s", + "help_string": "Required: filename for the rigid fit transform.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfIterations %d", + "help_string": "Number of iterations in the selected 3D fit", + }, + ), + ), + ( + "numberOfSamples", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfSamples %d", + "help_string": "The number of voxels sampled for mutual information computation. Increase this for a slower, more careful fit. NOTE that it is suggested to use samplingPercentage instead of this option. However, if set, it overwrites the samplingPercentage option. ", + }, + ), + ), + ( + "samplingPercentage", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--samplingPercentage %f", + "help_string": "This is a number in (0.0,1.0] interval that shows the percentage of the input fixed image voxels that are sampled for mutual information computation. Increase this for a slower, more careful fit. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation. The default is to use approximately 5% of voxels (for backwards compatibility 5% ~= 500000/(256*256*256)). Typical values range from 1% for low detail images to 20% for high detail images.", + }, + ), + ), + ( + "initialRotationAxis", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--initialRotationAxis %d", + "help_string": "Axis for the initial rotation angle: 0, 1, 2 mean x, y, z, respectively.", + }, + ), + ), + ( + "initialRotationAngle", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--initialRotationAngle %f", + "help_string": "Angle to rotate about the initial rotation angle (Degrees)", + }, + ), + ), + ( + "relaxationFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--relaxationFactor %f", + "help_string": "Fraction of gradient from Jacobian to attempt to move in the selected 3D fit", + }, + ), + ), + ( + "maximumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumStepSize %f", + "help_string": "Maximum permitted step size to move in the selected 3D fit", + }, + ), + ), + ( + "minimumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumStepSize %f", + "help_string": "Minimum required step size to move in the selected 3D fit without converging -- decrease this to make the fit more exacting", + }, + ), + ), + ( + "spatialScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--spatialScale %f", + "help_string": "How much to scale up changes in position compared to unit rotational changes in radians -- decrease this to put more translation in the fit", + }, + ), + ), + ] + output_fields = [ + ( + "outputRigidTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Required: filename for the rigid fit transform.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCoRegAnatomyRigid", + executable=" gtractCoRegAnatomyRigid ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractConcatDwi: + """ + title: Concat DWI Images + category: Diffusion.GTRACT + description: This program will concatenate two DTI runs together. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputVolume %s...", + "help_string": "Required: input file containing the first diffusion weighted image", + }, + ), + ), + ( + "ignoreOrigins", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--ignoreOrigins ", + "help_string": "If image origins are different force all images to origin of first image", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the combined diffusion weighted images.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the combined diffusion weighted images.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractConcatDwi", + executable=" gtractConcatDwi ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCopyImageOrientation: + """ + title: Copy Image Orientation + category: Diffusion.GTRACT + description: This program will copy the orientation from the reference image into the moving image. Currently, the registration process requires that the diffusion weighted images and the anatomical images have the same image orientation (i.e. Axial, Coronal, Sagittal). It is suggested that you copy the image orientation from the diffusion weighted images and apply this to the anatomical image. This image can be subsequently removed after the registration step is complete. We anticipate that this limitation will be removed in future versions of the registration programs. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input file containing the signed short image to reorient without resampling.", + "exists": "True", + }, + ), + ), + ( + "inputReferenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputReferenceVolume %s", + "help_string": "Required: input file containing orietation that will be cloned.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD or Nifti file containing the reoriented image in reference image space.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD or Nifti file containing the reoriented image in reference image space.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCopyImageOrientation", + executable=" gtractCopyImageOrientation ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCoregBvalues: + """ + title: Coregister B-Values + category: Diffusion.GTRACT + description: This step should be performed after converting DWI scans from DICOM to NRRD format. This program will register all gradients in a NRRD diffusion weighted 4D vector image (moving image) to a specified index in a fixed image. It also supports co-registration with a T2 weighted image or field map in the same plane as the DWI data. The fixed image for the registration should be a b0 image. A mutual information metric cost function is used for the registration because of the differences in signal intensity as a result of the diffusion gradients. The full affine allows the registration procedure to correct for eddy current distortions that may exist in the data. If the eddyCurrentCorrection is enabled, relaxationFactor (0.25) and maximumStepSize (0.1) should be adjusted. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "movingVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--movingVolume %s", + "help_string": "Required: input moving image file name. In order to register gradients within a scan to its first gradient, set the movingVolume and fixedVolume as the same image.", + "exists": "True", + }, + ), + ), + ( + "fixedVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--fixedVolume %s", + "help_string": "Required: input fixed image file name. It is recommended that this image should either contain or be a b0 image.", + "exists": "True", + }, + ), + ), + ( + "fixedVolumeIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--fixedVolumeIndex %d", + "help_string": "Index in the fixed image for registration. It is recommended that this image should be a b0 image.", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing moving images individually resampled and fit to the specified fixed image index.", + "hash_files": "False", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransform %s", + "help_string": "Registration 3D transforms concatenated in a single output file. There are no tools that can use this, but can be used for debugging purposes.", + "hash_files": "False", + }, + ), + ), + ( + "eddyCurrentCorrection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--eddyCurrentCorrection ", + "help_string": "Flag to perform eddy current corection in addition to motion correction (recommended)", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfIterations %d", + "help_string": "Number of iterations in each 3D fit", + }, + ), + ), + ( + "numberOfSpatialSamples", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfSpatialSamples %d", + "help_string": "The number of voxels sampled for mutual information computation. Increase this for a slower, more careful fit. NOTE that it is suggested to use samplingPercentage instead of this option. However, if set, it overwrites the samplingPercentage option. ", + }, + ), + ), + ( + "samplingPercentage", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--samplingPercentage %f", + "help_string": "This is a number in (0.0,1.0] interval that shows the percentage of the input fixed image voxels that are sampled for mutual information computation. Increase this for a slower, more careful fit. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation. The default is to use approximately 5% of voxels (for backwards compatibility 5% ~= 500000/(256*256*256)). Typical values range from 1% for low detail images to 20% for high detail images.", + }, + ), + ), + ( + "relaxationFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--relaxationFactor %f", + "help_string": "Fraction of gradient from Jacobian to attempt to move in each 3D fit step (adjust when eddyCurrentCorrection is enabled; suggested value = 0.25)", + }, + ), + ), + ( + "maximumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumStepSize %f", + "help_string": "Maximum permitted step size to move in each 3D fit step (adjust when eddyCurrentCorrection is enabled; suggested value = 0.1)", + }, + ), + ), + ( + "minimumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumStepSize %f", + "help_string": "Minimum required step size to move in each 3D fit step without converging -- decrease this to make the fit more exacting", + }, + ), + ), + ( + "spatialScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--spatialScale %f", + "help_string": "How much to scale up changes in position compared to unit rotational changes in radians -- decrease this to put more rotation in the fit", + }, + ), + ), + ( + "registerB0Only", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--registerB0Only ", + "help_string": "Register the B0 images only", + }, + ), + ), + ( + "debugLevel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--debugLevel %d", + "help_string": "Display debug messages, and produce debug intermediate results. 0=OFF, 1=Minimal, 10=Maximum debugging.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing moving images individually resampled and fit to the specified fixed image index.", + "exists": "True", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Registration 3D transforms concatenated in a single output file. There are no tools that can use this, but can be used for debugging purposes.", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCoregBvalues", + executable=" gtractCoregBvalues ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCostFastMarching: + """ + title: Cost Fast Marching + category: Diffusion.GTRACT + description: This program will use a fast marching fiber tracking algorithm to identify fiber tracts from a tensor image. This program is the first portion of the algorithm. The user must first run gtractFastMarchingTracking to generate the actual fiber tracts. This algorithm is roughly based on the work by G. Parker et al. from IEEE Transactions On Medical Imaging, 21(5): 505-512, 2002. An additional feature of including anisotropy into the vcl_cost function calculation is included. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. The original code here was developed by Daisy Espino. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required: input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds", + }, + ), + ), + ( + "outputCostVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputCostVolume %s", + "help_string": "Output vcl_cost image", + "hash_files": "False", + }, + ), + ), + ( + "outputSpeedVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputSpeedVolume %s", + "help_string": "Output speed image", + "hash_files": "False", + }, + ), + ), + ( + "anisotropyWeight", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--anisotropyWeight %f", + "help_string": "Anisotropy weight used for vcl_cost function calculations", + }, + ), + ), + ( + "stoppingValue", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--stoppingValue %f", + "help_string": "Terminiating value for vcl_cost function estimation", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold used for seed selection", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputCostVolume", + attr.ib( + type=File, + metadata={"help_string": "Output vcl_cost image", "exists": "True"}, + ), + ), + ( + "outputSpeedVolume", + attr.ib( + type=File, + metadata={"help_string": "Output speed image", "exists": "True"}, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCostFastMarching", + executable=" gtractCostFastMarching ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractCreateGuideFiber: + """ + title: Create Guide Fiber + category: Diffusion.GTRACT + description: This program will create a guide fiber by averaging fibers from a previously generated tract. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputFiber", + attr.ib( + type=File, + metadata={ + "argstr": "--inputFiber %s", + "help_string": "Required: input fiber tract file name", + "exists": "True", + }, + ), + ), + ( + "numberOfPoints", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfPoints %d", + "help_string": "Number of points in output guide fiber", + }, + ), + ), + ( + "outputFiber", + attr.ib( + type=File, + metadata={ + "argstr": "--outputFiber %s", + "help_string": "Required: output guide fiber file name", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of XML files when reading and writing vtkPolyData.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputFiber", + attr.ib( + type=File, + metadata={ + "help_string": "Required: output guide fiber file name", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractCreateGuideFiber", + executable=" gtractCreateGuideFiber ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractFastMarchingTracking: + """ + title: Fast Marching Tracking + category: Diffusion.GTRACT + description: This program will use a fast marching fiber tracking algorithm to identify fiber tracts from a tensor image. This program is the second portion of the algorithm. The user must first run gtractCostFastMarching to generate the vcl_cost image. The second step of the algorithm implemented here is a gradient descent soplution from the defined ending region back to the seed points specified in gtractCostFastMarching. This algorithm is roughly based on the work by G. Parker et al. from IEEE Transactions On Medical Imaging, 21(5): 505-512, 2002. An additional feature of including anisotropy into the vcl_cost function calculation is included. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. The original code here was developed by Daisy Espino. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputCostVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputCostVolume %s", + "help_string": "Required: input vcl_cost image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required: input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfIterations %d", + "help_string": "Number of iterations used for the optimization", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold used for seed selection", + }, + ), + ), + ( + "trackingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trackingThreshold %f", + "help_string": "Anisotropy threshold used for fiber tracking", + }, + ), + ), + ( + "costStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--costStepSize %f", + "help_string": "Cost image sub-voxel sampling", + }, + ), + ), + ( + "maximumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumStepSize %f", + "help_string": "Maximum step size to move when tracking", + }, + ), + ), + ( + "minimumStepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumStepSize %f", + "help_string": "Minimum step size to move when tracking", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractFastMarchingTracking", + executable=" gtractFastMarchingTracking ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractFiberTracking: + """ + title: Fiber Tracking + category: Diffusion.GTRACT + description: This program implements four fiber tracking methods (Free, Streamline, GraphSearch, Guided). The output of the fiber tracking is vtkPolyData (i.e. Polylines) that can be loaded into Slicer3 for visualization. The poly data can be saved in either old VTK format files (.vtk) or in the new VTK XML format (.xml). The polylines contain point data that defines ther Tensor at each point along the fiber tract. This can then be used to rendered as glyphs in Slicer3 and can be used to define severeal scalar measures without referencing back to the anisotropy images. (1) Free tracking is a basic streamlines algorithm. This is a direct implementation of the method original proposed by Basser et al. The tracking follows the primarty eigenvector. The tracking begins with seed points in the starting region. Only those voxels above the specified anisotropy threshold in the starting region are used as seed points. Tracking terminates either as a result of maximum fiber length, low ansiotropy, or large curvature. This is a great way to explore your data. (2) The streamlines algorithm is a direct implementation of the method originally proposed by Basser et al. The tracking follows the primary eigenvector. The tracking begins with seed points in the starting region. Only those voxels above the specified anisotropy threshold in the starting region are used as seed points. Tracking terminates either by reaching the ending region or reaching some stopping criteria. Stopping criteria are specified using the following parameters: tracking threshold, curvature threshold, and max length. Only paths terminating in the ending region are kept in this method. The TEND algorithm proposed by Lazar et al. (Human Brain Mapping 18:306-321, 2003) has been instrumented. This can be enabled using the --useTend option while performing Streamlines tracking. This utilizes the entire diffusion tensor to deflect the incoming vector instead of simply following the primary eigenvector. The TEND parameters are set using the --tendF and --tendG options. (3) Graph Search tracking is the first step in the full GTRACT algorithm developed by Cheng et al. (NeuroImage 31(3): 1075-1085, 2006) for finding the tracks in a tensor image. This method was developed to generate fibers in a Tensor representation where crossing fibers occur. The graph search algorithm follows the primary eigenvector in non-ambigous regions and utilizes branching and a graph search algorithm in ambigous regions. Ambiguous tracking regions are defined based on two criteria: Branching Al Threshold (anisotropy values below this value and above the traching threshold) and Curvature Major Eigen (angles of the primary eigenvector direction and the current tracking direction). In regions that meet this criteria, two or three tracking paths are considered. The first is the standard primary eigenvector direction. The second is the seconadary eigenvector direction. This is based on the assumption that these regions may be prolate regions. If the Random Walk option is selected then a third direction is also considered. This direction is defined by a cone pointing from the current position to the centroid of the ending region. The interior angle of the cone is specified by the user with the Branch/Guide Angle parameter. A vector contained inside of the cone is selected at random and used as the third direction. This method can also utilize the TEND option where the primary tracking direction is that specified by the TEND method instead of the primary eigenvector. The parameter '--maximumBranchPoints' allows the tracking to have this number of branches being considered at a time. If this number of branch points is exceeded at any time, then the algorithm will revert back to a streamline alogrithm until the number of branches is reduced. This allows the user to constrain the computational complexity of the algorithm. (4) The second phase of the GTRACT algorithm is Guided Tracking. This method incorporates anatomical information about the track orientation using an initial guess of the fiber track. In the originally proposed GTRACT method, this would be created from the fibers resulting from the Graph Search tracking. However, in practice this can be created using any method and could be defined manually. To create the guide fiber the program gtractCreateGuideFiber can be used. This program will load a fiber tract that has been generated and create a centerline representation of the fiber tract (i.e. a single fiber). In this method, the fiber tracking follows the primary eigenvector direction unless it deviates from the guide fiber track by a angle greater than that specified by the '--guidedCurvatureThreshold' parameter. The user must specify the guide fiber when running this program. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta, Greg Harris and Yongqiang Zhao. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required (for Free, Streamline, GraphSearch, and Guided fiber tracking methods): input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required (for Free, Streamline, GraphSearch, and Guided fiber tracking methods): input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required (for Free, Streamline, GraphSearch, and Guided fiber tracking methods): input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds (required if Label number used to create seed point in Slicer was not 1)", + }, + ), + ), + ( + "inputEndingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputEndingSeedsLabelMapVolume %s", + "help_string": "Required (for Streamline, GraphSearch, and Guided fiber tracking methods): input ending seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "endingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--endingSeedsLabel %d", + "help_string": "Label value for Ending Seeds (required if Label number used to create seed point in Slicer was not 1)", + }, + ), + ), + ( + "inputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTract %s", + "help_string": "Required (for Guided fiber tracking method): guide fiber in vtkPolydata file containing one tract line.", + "exists": "True", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required (for Free, Streamline, GraphSearch, and Guided fiber tracking methods): name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "trackingMethod", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--trackingMethod %s", + "help_string": "Fiber tracking Filter Type: Guided|Free|Streamline|GraphSearch", + }, + ), + ), + ( + "guidedCurvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--guidedCurvatureThreshold %f", + "help_string": "Guided Curvature Threshold (Degrees)", + }, + ), + ), + ( + "maximumGuideDistance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumGuideDistance %f", + "help_string": "Maximum distance for using the guide fiber direction", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold for seed selection (recommended for Free fiber tracking)", + }, + ), + ), + ( + "trackingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trackingThreshold %f", + "help_string": "Anisotropy threshold for fiber tracking (anisotropy values of the next point along the path)", + }, + ), + ), + ( + "curvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--curvatureThreshold %f", + "help_string": "Curvature threshold in degrees (recommended for Free fiber tracking)", + }, + ), + ), + ( + "branchingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--branchingThreshold %f", + "help_string": "Anisotropy Branching threshold (recommended for GraphSearch fiber tracking method)", + }, + ), + ), + ( + "maximumBranchPoints", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maximumBranchPoints %d", + "help_string": "Maximum branch points (recommended for GraphSearch fiber tracking method)", + }, + ), + ), + ( + "useRandomWalk", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useRandomWalk ", + "help_string": "Flag to use random walk.", + }, + ), + ), + ( + "randomSeed", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--randomSeed %d", + "help_string": "Random number generator seed", + }, + ), + ), + ( + "branchingAngle", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--branchingAngle %f", + "help_string": "Branching angle in degrees (recommended for GraphSearch fiber tracking method)", + }, + ), + ), + ( + "minimumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumLength %f", + "help_string": "Minimum fiber length. Helpful for filtering invalid tracts.", + }, + ), + ), + ( + "maximumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumLength %f", + "help_string": "Maximum fiber length (voxels)", + }, + ), + ), + ( + "stepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--stepSize %f", + "help_string": "Fiber tracking step size", + }, + ), + ), + ( + "useLoopDetection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useLoopDetection ", + "help_string": "Flag to make use of loop detection.", + }, + ), + ), + ( + "useTend", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useTend ", + "help_string": "Flag to make use of Tend F and Tend G parameters.", + }, + ), + ), + ( + "tendF", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendF %f", "help_string": "Tend F parameter"}, + ), + ), + ( + "tendG", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendG %f", "help_string": "Tend G parameter"}, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required (for Free, Streamline, GraphSearch, and Guided fiber tracking methods): name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractFiberTracking", + executable=" gtractFiberTracking ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractFreeTracking: + """ + title: Free Tracking + category: Diffusion.GTRACT + description: This program will use streamlines fiber tracking to identify fiber tracts in a tensor image. A seed region is specify for initializing the algorithm. All fibers are kept and are terminated based on the stopping criteria including anisotropy, curvature and length. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required: input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold for seed selection", + }, + ), + ), + ( + "trackingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trackingThreshold %f", + "help_string": "Anisotropy threshold for fiber tracking", + }, + ), + ), + ( + "curvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--curvatureThreshold %f", + "help_string": "Curvature threshold (Degrees)", + }, + ), + ), + ( + "minimumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumLength %f", + "help_string": "Minimum fiber length. Helpful for filtering invalid tracts.", + }, + ), + ), + ( + "maximumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumLength %f", + "help_string": "Maximum fiber length", + }, + ), + ), + ( + "stepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--stepSize %f", + "help_string": "Fiber tracking step size", + }, + ), + ), + ( + "useLoopDetection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useLoopDetection ", + "help_string": "Flag to make use of loop detection.", + }, + ), + ), + ( + "useTend", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useTend ", + "help_string": "Flag to make use of Tend F and Tend G parameters.", + }, + ), + ), + ( + "tendF", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendF %f", "help_string": "Tend F parameter"}, + ), + ), + ( + "tendG", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendG %f", "help_string": "Tend G parameter"}, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractFreeTracking", + executable=" gtractFreeTracking ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractGraphSearchTracking: + """ + title: Graph Search Tracking + category: Diffusion.GTRACT + description: This program implements the Graph Serach Tracking method proposed by Cheng et al. in NeuroImage Volume 31, Issue 3, 1 July 2006, Pages 1075-1085 for finding the tracks in a tensor image. This method to generate fibers in a Tensor representation where crossing fibers occur. This is defined by low anisotropy and high curvature. Both of these values are controlled by the user. In these regions, three directions for tracking are considered. This includes the primary eigenvector, secondary eigenvector, and a vector with random pertubations added pointing towards the ending region. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required: input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds", + }, + ), + ), + ( + "inputEndingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputEndingSeedsLabelMapVolume %s", + "help_string": "Required: input ending seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "endingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--endingSeedsLabel %d", + "help_string": "Label value for Ending Seeds", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold for seed selection", + }, + ), + ), + ( + "trackingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trackingThreshold %f", + "help_string": "Anisotropy threshold for fiber tracking", + }, + ), + ), + ( + "curvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--curvatureThreshold %f", + "help_string": "Curvature threshold (Degrees)", + }, + ), + ), + ( + "branchingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--branchingThreshold %f", + "help_string": "Anisotropy Branching threshold", + }, + ), + ), + ( + "maximumBranchPoints", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maximumBranchPoints %d", + "help_string": "Maximum branch points", + }, + ), + ), + ( + "useRandomWalk", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useRandomWalk ", + "help_string": "Flag to use random walk.", + }, + ), + ), + ( + "randomSeed", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--randomSeed %d", + "help_string": "Random number generator seed", + }, + ), + ), + ( + "branchingAngle", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--branchingAngle %f", + "help_string": "Branchging angle (Degrees)", + }, + ), + ), + ( + "minimumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumLength %f", + "help_string": "Minimum fiber length. Helpful for filtering invalid tracts.", + }, + ), + ), + ( + "maximumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumLength %f", + "help_string": "Maximum fiber length", + }, + ), + ), + ( + "stepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--stepSize %f", + "help_string": "Fiber tracking step size", + }, + ), + ), + ( + "useLoopDetection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useLoopDetection ", + "help_string": "Flag to make use of loop detection.", + }, + ), + ), + ( + "useTend", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useTend ", + "help_string": "Flag to make use of Tend F and Tend G parameters.", + }, + ), + ), + ( + "tendF", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendF %f", "help_string": "Tend F parameter"}, + ), + ), + ( + "tendG", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendG %f", "help_string": "Tend G parameter"}, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractGraphSearchTracking", + executable=" gtractGraphSearchTracking ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractGuidedTracking: + """ + title: Guided Tracking + category: Diffusion.GTRACT + description: This program will use the Guided Tracking method proposed by Cheng et al. in NeuroImage Volume 31, Issue 3, 1 July 2006, Pages 1075-1085 for finding the tracks in a tensor image. The method will use a guide fiber as apriori information for the fiber tract position and orientation. If the current eigenvector direction is significantly different from the guide fiber direction at that point, then the guide fiber is used instead of the eigenvector direction. The distance for which the guide fiber has an effect is defined by the user. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required: input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds", + }, + ), + ), + ( + "inputEndingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputEndingSeedsLabelMapVolume %s", + "help_string": "Required: input ending seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "endingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--endingSeedsLabel %d", + "help_string": "Label value for Ending Seeds", + }, + ), + ), + ( + "inputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTract %s", + "help_string": "Required: guide fiber in vtkPolydata file containing one tract line.", + "exists": "True", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold for seed selection", + }, + ), + ), + ( + "trackingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trackingThreshold %f", + "help_string": "Anisotropy threshold for fiber tracking", + }, + ), + ), + ( + "maximumGuideDistance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumGuideDistance %f", + "help_string": "Maximum distance for using the guide fiber direction", + }, + ), + ), + ( + "curvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--curvatureThreshold %f", + "help_string": "Curvature threshold (Degrees)", + }, + ), + ), + ( + "guidedCurvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--guidedCurvatureThreshold %f", + "help_string": "Guided Curvature Threshold (Degrees)", + }, + ), + ), + ( + "minimumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumLength %f", + "help_string": "Minimum fiber length. Helpful for filtering invalid tracts.", + }, + ), + ), + ( + "maximumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumLength %f", + "help_string": "Maximum fiber length", + }, + ), + ), + ( + "stepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--stepSize %f", + "help_string": "Fiber tracking step size", + }, + ), + ), + ( + "useLoopDetection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useLoopDetection ", + "help_string": "Flag to make use of loop detection.", + }, + ), + ), + ( + "useTend", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useTend ", + "help_string": "Flag to make use of Tend F and Tend G parameters.", + }, + ), + ), + ( + "tendF", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendF %f", "help_string": "Tend F parameter"}, + ), + ), + ( + "tendG", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendG %f", "help_string": "Tend G parameter"}, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractGuidedTracking", + executable=" gtractGuidedTracking ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractImageConformity: + """ + title: Image Conformity + category: Diffusion.GTRACT + description: This program will straighten out the Direction and Origin to match the Reference Image. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input file containing the signed short image to reorient without resampling.", + "exists": "True", + }, + ), + ), + ( + "inputReferenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputReferenceVolume %s", + "help_string": "Required: input file containing the standard image to clone the characteristics of.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output Nrrd or Nifti file containing the reoriented image in reference image space.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output Nrrd or Nifti file containing the reoriented image in reference image space.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractImageConformity", + executable=" gtractImageConformity ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractInvertBSplineTransform: + """ + title: B-Spline Transform Inversion + category: Diffusion.GTRACT + description: This program will invert a B-Spline transform using a thin-plate spline approximation. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputReferenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputReferenceVolume %s", + "help_string": "Required: input image file name to exemplify the anatomical space to interpolate over.", + "exists": "True", + }, + ), + ), + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Required: input B-Spline transform file name", + "exists": "True", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransform %s", + "help_string": "Required: output transform file name", + "hash_files": "False", + }, + ), + ), + ( + "landmarkDensity", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--landmarkDensity %s", + "help_string": "Number of landmark subdivisions in all 3 directions", + "sep": ",", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Required: output transform file name", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractInvertBSplineTransform", + executable=" gtractInvertBSplineTransform ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractInvertDisplacementField: + """ + title: Invert Displacement Field + category: Diffusion.GTRACT + description: This program will invert a deformatrion field. The size of the deformation field is defined by an example image provided by the user + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "baseImage", + attr.ib( + type=File, + metadata={ + "argstr": "--baseImage %s", + "help_string": "Required: base image used to define the size of the inverse field", + "exists": "True", + }, + ), + ), + ( + "deformationImage", + attr.ib( + type=File, + metadata={ + "argstr": "--deformationImage %s", + "help_string": "Required: Displacement field image", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: Output deformation field", + "hash_files": "False", + }, + ), + ), + ( + "subsamplingFactor", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--subsamplingFactor %d", + "help_string": "Subsampling factor for the deformation field", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: Output deformation field", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractInvertDisplacementField", + executable=" gtractInvertDisplacementField ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractInvertRigidTransform: + """ + title: Rigid Transform Inversion + category: Diffusion.GTRACT + description: This program will invert a Rigid transform. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Required: input rigid transform file name", + "exists": "True", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransform %s", + "help_string": "Required: output transform file name", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Required: output transform file name", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractInvertRigidTransform", + executable=" gtractInvertRigidTransform ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractResampleAnisotropy: + """ + title: Resample Anisotropy + category: Diffusion.GTRACT + description: This program will resample a floating point image using either the Rigid or B-Spline transform. You may want to save the aligned B0 image after each of the anisotropy map co-registration steps with the anatomical image to check the registration quality with another tool. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input file containing the anisotropy image", + "exists": "True", + }, + ), + ), + ( + "inputAnatomicalVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnatomicalVolume %s", + "help_string": "Required: input file containing the anatomical image whose characteristics will be cloned.", + "exists": "True", + }, + ), + ), + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Required: input Rigid OR Bspline transform file name", + "exists": "True", + }, + ), + ), + ( + "transformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transformType %s", + "help_string": "Transform type: Rigid, B-Spline", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the resampled transformed anisotropy image.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the resampled transformed anisotropy image.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractResampleAnisotropy", + executable=" gtractResampleAnisotropy ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractResampleB0: + """ + title: Resample B0 + category: Diffusion.GTRACT + description: This program will resample a signed short image using either a Rigid or B-Spline transform. The user must specify a template image that will be used to define the origin, orientation, spacing, and size of the resampled image. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input file containing the 4D image", + "exists": "True", + }, + ), + ), + ( + "inputAnatomicalVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnatomicalVolume %s", + "help_string": "Required: input file containing the anatomical image defining the origin, spacing and size of the resampled image (template)", + "exists": "True", + }, + ), + ), + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Required: input Rigid OR Bspline transform file name", + "exists": "True", + }, + ), + ), + ( + "vectorIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--vectorIndex %d", + "help_string": "Index in the diffusion weighted image set for the B0 image", + }, + ), + ), + ( + "transformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transformType %s", + "help_string": "Transform type: Rigid, B-Spline", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the resampled input image.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the resampled input image.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractResampleB0", + executable=" gtractResampleB0 ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractResampleCodeImage: + """ + title: Resample Code Image + category: Diffusion.GTRACT + description: This program will resample a short integer code image using either the Rigid or Inverse-B-Spline transform. The reference image is the DTI tensor anisotropy image space, and the input code image is in anatomical space. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputCodeVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputCodeVolume %s", + "help_string": "Required: input file containing the code image", + "exists": "True", + }, + ), + ), + ( + "inputReferenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputReferenceVolume %s", + "help_string": "Required: input file containing the standard image to clone the characteristics of.", + "exists": "True", + }, + ), + ), + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Required: input Rigid or Inverse-B-Spline transform file name", + "exists": "True", + }, + ), + ), + ( + "transformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transformType %s", + "help_string": "Transform type: Rigid or Inverse-B-Spline", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the resampled code image in acquisition space.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the resampled code image in acquisition space.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractResampleCodeImage", + executable=" gtractResampleCodeImage ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractResampleDWIInPlace: + """ + title: Resample DWI In Place + category: Diffusion.GTRACT + description: Resamples DWI image to structural image. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta, Greg Harris, Hans Johnson, and Joy Matsui. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input image is a 4D NRRD image.", + "exists": "True", + }, + ), + ), + ( + "referenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--referenceVolume %s", + "help_string": "If provided, resample to the final space of the referenceVolume 3D data set.", + "exists": "True", + }, + ), + ), + ( + "outputResampledB0", + attr.ib( + type=File, + metadata={ + "argstr": "--outputResampledB0 %s", + "help_string": "Convenience function for extracting the first index location (assumed to be the B0)", + "hash_files": "False", + }, + ), + ), + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Required: transform file derived from rigid registration of b0 image to reference structural image.", + "exists": "True", + }, + ), + ), + ( + "warpDWITransform", + attr.ib( + type=File, + metadata={ + "argstr": "--warpDWITransform %s", + "help_string": "Optional: transform file to warp gradient volumes.", + "exists": "True", + }, + ), + ), + ( + "debugLevel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--debugLevel %d", + "help_string": "Display debug messages, and produce debug intermediate results. 0=OFF, 1=Minimal, 10=Maximum debugging.", + }, + ), + ), + ( + "writeOutputMetaData", + attr.ib( + type=File, + metadata={ + "argstr": "--writeOutputMetaData %s", + "help_string": "A file to write the output image diffusion gradient directions in a CSV file", + "hash_files": "False", + }, + ), + ), + ( + "imageOutputSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--imageOutputSize %s", + "help_string": "The voxel lattice for the output image, padding is added if necessary. NOTE: if 0,0,0, then the inputVolume size is used.", + "sep": ",", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: output image (NRRD file) that has been rigidly transformed into the space of the structural image and padded if image padding was changed from 0,0,0 default.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputResampledB0", + attr.ib( + type=File, + metadata={ + "help_string": "Convenience function for extracting the first index location (assumed to be the B0)", + "exists": "True", + }, + ), + ), + ( + "writeOutputMetaData", + attr.ib( + type=File, + metadata={ + "help_string": "A file to write the output image diffusion gradient directions in a CSV file", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: output image (NRRD file) that has been rigidly transformed into the space of the structural image and padded if image padding was changed from 0,0,0 default.", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractResampleDWIInPlace", + executable=" gtractResampleDWIInPlace ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractResampleFibers: + """ + title: Resample Fibers + category: Diffusion.GTRACT + description: This program will resample a fiber tract with respect to a pair of deformation fields that represent the forward and reverse deformation fields. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputForwardDeformationFieldVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputForwardDeformationFieldVolume %s", + "help_string": "Required: input forward deformation field image file name", + "exists": "True", + }, + ), + ), + ( + "inputReverseDeformationFieldVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputReverseDeformationFieldVolume %s", + "help_string": "Required: input reverse deformation field image file name", + "exists": "True", + }, + ), + ), + ( + "inputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTract %s", + "help_string": "Required: name of input vtkPolydata file containing tract lines.", + "exists": "True", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractResampleFibers", + executable=" gtractResampleFibers ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractStreamlineTracking: + """ + title: Streamline Tracking + category: Diffusion.GTRACT + description: This program create fiber tracts in a tensor image using a basic streamlines algorithm. The algorithm requires a starting and ending region to be be defined for the fiber tracts. Only those that reach the ending region without terminating are kept. Criteria for termination include length, anisotropy, and curvature. These can be controlled by user. In addition, the TEND method as proposed by Lazar et al Human Brain Mapping 18:306-321(2003) has been instrumented. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTensorVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTensorVolume %s", + "help_string": "Required: input tensor image file name", + "exists": "True", + }, + ), + ), + ( + "inputAnisotropyVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputAnisotropyVolume %s", + "help_string": "Required: input anisotropy image file name", + "exists": "True", + }, + ), + ), + ( + "inputStartingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputStartingSeedsLabelMapVolume %s", + "help_string": "Required: input starting seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "startingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--startingSeedsLabel %d", + "help_string": "Label value for Starting Seeds", + }, + ), + ), + ( + "inputEndingSeedsLabelMapVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputEndingSeedsLabelMapVolume %s", + "help_string": "Required: input ending seeds LabelMap image file name", + "exists": "True", + }, + ), + ), + ( + "endingSeedsLabel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--endingSeedsLabel %d", + "help_string": "Label value for Ending Seeds", + }, + ), + ), + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTract %s", + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "hash_files": "False", + }, + ), + ), + ( + "writeXMLPolyDataFile", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeXMLPolyDataFile ", + "help_string": "Flag to make use of the XML format for vtkPolyData fiber tracts.", + }, + ), + ), + ( + "seedThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--seedThreshold %f", + "help_string": "Anisotropy threshold for seed selection", + }, + ), + ), + ( + "trackingThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trackingThreshold %f", + "help_string": "Anisotropy threshold for fiber tracking", + }, + ), + ), + ( + "curvatureThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--curvatureThreshold %f", + "help_string": "Curvature threshold (Degrees)", + }, + ), + ), + ( + "minimumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--minimumLength %f", + "help_string": "Minimum fiber length. Helpful for filtering invalid tracts.", + }, + ), + ), + ( + "maximumLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumLength %f", + "help_string": "Maximum fiber length", + }, + ), + ), + ( + "stepSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--stepSize %f", + "help_string": "Fiber tracking step size", + }, + ), + ), + ( + "useLoopDetection", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useLoopDetection ", + "help_string": "Flag to make use of loop detection.", + }, + ), + ), + ( + "useTend", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useTend ", + "help_string": "Flag to make use of Tend F and Tend G parameters.", + }, + ), + ), + ( + "tendF", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendF %f", "help_string": "Tend F parameter"}, + ), + ), + ( + "tendG", + attr.ib( + type=traits.Float, + metadata={"argstr": "--tendG %f", "help_string": "Tend G parameter"}, + ), + ), + ] + output_fields = [ + ( + "outputTract", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output vtkPolydata file containing tract lines and the point data collected along them.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractStreamlineTracking", + executable=" gtractStreamlineTracking ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractTensor: + """ + title: Tensor Estimation + category: Diffusion.GTRACT + description: This step will convert a b-value averaged diffusion tensor image to a 3x3 tensor voxel image. This step takes the diffusion tensor image data and generates a tensor representation of the data based on the signal intensity decay, b values applied, and the diffusion difrections. The apparent diffusion coefficient for a given orientation is computed on a pixel-by-pixel basis by fitting the image data (voxel intensities) to the Stejskal-Tanner equation. If at least 6 diffusion directions are used, then the diffusion tensor can be computed. This program uses itk::DiffusionTensor3DReconstructionImageFilter. The user can adjust background threshold, median filter, and isotropic resampling. + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta and Greg Harris. + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input image 4D NRRD image. Must contain data based on at least 6 distinct diffusion directions. The inputVolume is allowed to have multiple b0 and gradient direction images. Averaging of the b0 image is done internally in this step. Prior averaging of the DWIs is not required.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Required: name of output NRRD file containing the Tensor vector image", + "hash_files": "False", + }, + ), + ), + ( + "medianFilterSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--medianFilterSize %s", + "help_string": "Median filter radius in all 3 directions", + "sep": ",", + }, + ), + ), + ( + "maskProcessingMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--maskProcessingMode %s", + "help_string": "ROIAUTO: mask is implicitly defined using a otsu forground and hole filling algorithm. ROI: Uses the masks to define what parts of the image should be used for computing the transform. NOMASK: no mask used", + }, + ), + ), + ( + "maskVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--maskVolume %s", + "help_string": "Mask Image, if maskProcessingMode is ROI", + "exists": "True", + }, + ), + ), + ( + "backgroundSuppressingThreshold", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--backgroundSuppressingThreshold %d", + "help_string": "Image threshold to suppress background. This sets a threshold used on the b0 image to remove background voxels from processing. Typically, values of 100 and 500 work well for Siemens and GE DTI data, respectively. Check your data particularly in the globus pallidus to make sure the brain tissue is not being eliminated with this threshold.", + }, + ), + ), + ( + "resampleIsotropic", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--resampleIsotropic ", + "help_string": "Flag to resample to isotropic voxels. Enabling this feature is recommended if fiber tracking will be performed.", + }, + ), + ), + ( + "size", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--size %f", + "help_string": "Isotropic voxel size to resample to", + }, + ), + ), + ( + "b0Index", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--b0Index %d", + "help_string": "Index in input vector index to extract", + }, + ), + ), + ( + "applyMeasurementFrame", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--applyMeasurementFrame ", + "help_string": "Flag to apply the measurement frame to the gradient directions", + }, + ), + ), + ( + "ignoreIndex", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--ignoreIndex %s", + "help_string": "Ignore diffusion gradient index. Used to remove specific gradient directions with artifacts.", + "sep": ",", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Required: name of output NRRD file containing the Tensor vector image", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractTensor", + executable=" gtractTensor ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class gtractTransformToDisplacementField: + """ + title: Create Displacement Field + category: Diffusion.GTRACT + description: This program will compute forward deformation from the given Transform. The size of the DF is equal to MNI space + version: 5.2.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Modules:GTRACT + license: http://mri.radiology.uiowa.edu/copyright/GTRACT-Copyright.txt + contributor: This tool was developed by Vincent Magnotta, Madhura Ingalhalikar, and Greg Harris + acknowledgements: Funding for this version of the GTRACT program was provided by NIH/NINDS R01NS050568-01A2S1 + """ + + input_fields = [ + ( + "inputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTransform %s", + "help_string": "Input Transform File Name", + "exists": "True", + }, + ), + ), + ( + "inputReferenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputReferenceVolume %s", + "help_string": "Required: input image file name to exemplify the anatomical space over which to vcl_express the transform as a displacement field.", + "exists": "True", + }, + ), + ), + ( + "outputDeformationFieldVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputDeformationFieldVolume %s", + "help_string": "Output deformation field", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputDeformationFieldVolume", + attr.ib( + type=File, + metadata={"help_string": "Output deformation field", "exists": "True"}, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="gtractTransformToDisplacementField", + executable=" gtractTransformToDisplacementField ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/diffusion/utilities.py b/pydra/tasks/sem/diffusion/utilities.py new file mode 100644 index 0000000..2d40151 --- /dev/null +++ b/pydra/tasks/sem/diffusion/utilities.py @@ -0,0 +1,392 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSDWICleanup: + """ + title: BRAINSDWICleanup + category: Diffusion.Utilities + description: Remove bad gradients/volumes from DWI NRRD file. + version: 5.2.0 + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: This tool was developed by Kent Williams. + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Required: input image is a 4D NRRD image.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "given a list of ", + "hash_files": "False", + }, + ), + ), + ( + "badGradients", + attr.ib( + type=InputMultiPath, + metadata={"argstr": "--badGradients %s", "sep": ","}, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={"help_string": "given a list of ", "exists": "True"}, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSDWICleanup", + executable=" BRAINSDWICleanup ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class ResampleDTIVolume: + """ + title: Resample DTI Volume + category: Diffusion.Utilities + description: Resampling an image is a very important task in image analysis. It is especially important in the frame of image registration. This module implements DT image resampling through the use of itk Transforms. The resampling is controlled by the Output Spacing. "Resampling" is performed in space coordinates, not pixel/grid coordinates. It is quite important to ensure that image spacing is properly set on the images involved. The interpolator is required since the mapping from one space to the other will often require evaluation of the intensity of the image at non-grid positions. + version: 1.0.2 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ResampleDTI + contributor: Francois Budin (UNC) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. Information on the National Centers for Biomedical Computing can be obtained from http://nihroadmap.nih.gov/bioinformatics + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be resampled", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Resampled Volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "Reference", + attr.ib( + type=File, + metadata={ + "argstr": "--Reference %s", + "help_string": "Reference Volume (spacing,size,orientation,origin)", + "exists": "True", + }, + ), + ), + ( + "transformationFile", + attr.ib( + type=File, + metadata={"argstr": "--transformationFile %s", "exists": "True"}, + ), + ), + ( + "defField", + attr.ib( + type=File, + metadata={ + "argstr": "--defField %s", + "help_string": "File containing the deformation field (3D vector image containing vectors with 3 components)", + "exists": "True", + }, + ), + ), + ( + "hfieldtype", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--hfieldtype %s", + "help_string": "Set if the deformation field is an -Field", + }, + ), + ), + ( + "interpolation", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolation %s", + "help_string": "Sampling algorithm (linear , nn (nearest neighborhoor), ws (WindowedSinc), bs (BSpline) )", + }, + ), + ), + ( + "noMeasurementFrame", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--noMeasurementFrame ", + "help_string": "Do not use the measurement frame that is in the input image to transform the tensors. Uses the image orientation instead", + }, + ), + ), + ( + "correction", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--correction %s", + "help_string": "Correct the tensors if computed tensor is not semi-definite positive", + }, + ), + ), + ( + "transform_tensor_method", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transform_tensor_method %s", + "help_string": "Chooses between 2 methods to transform the tensors: Finite Strain (FS), faster but less accurate, or Preservation of the Principal Direction (PPD)", + }, + ), + ), + ( + "transform_order", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transform_order %s", + "help_string": "Select in what order the transforms are read", + }, + ), + ), + ( + "notbulk", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--notbulk ", + "help_string": "The transform following the BSpline transform is not set as a bulk transform for the BSpline transform", + }, + ), + ), + ( + "spaceChange", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--spaceChange ", + "help_string": "Space Orientation between transform and image is different (RAS/LPS) (warning: if the transform is a Transform Node in Slicer3, do not select)", + }, + ), + ), + ( + "rotation_point", + attr.ib( + type=traits.List, + metadata={ + "argstr": "--rotation_point %s", + "help_string": "Center of rotation (only for rigid and affine transforms)", + }, + ), + ), + ( + "centered_transform", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--centered_transform ", + "help_string": "Set the center of the transformation to the center of the input image (only for rigid and affine transforms)", + }, + ), + ), + ( + "image_center", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--image_center %s", + "help_string": "Image to use to center the transform (used only if 'Centered Transform' is selected)", + }, + ), + ), + ( + "Inverse_ITK_Transformation", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--Inverse_ITK_Transformation ", + "help_string": "Inverse the transformation before applying it from output image to input image (only for rigid and affine transforms)", + }, + ), + ), + ( + "spacing", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--spacing %s", + "help_string": "Spacing along each dimension (0 means use input spacing)", + "sep": ",", + }, + ), + ), + ( + "size", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--size %s", + "help_string": "Size along each dimension (0 means use input size)", + "sep": ",", + }, + ), + ), + ( + "origin", + attr.ib( + type=traits.List, + metadata={ + "argstr": "--origin %s", + "help_string": "Origin of the output Image", + }, + ), + ), + ( + "direction_matrix", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--direction_matrix %s", + "help_string": "9 parameters of the direction matrix by rows (ijk to LPS if LPS transform, ijk to RAS if RAS transform)", + "sep": ",", + }, + ), + ), + ( + "number_of_thread", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--number_of_thread %d", + "help_string": "Number of thread used to compute the output image", + }, + ), + ), + ( + "default_pixel_value", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--default_pixel_value %f", + "help_string": "Default pixel value for samples falling outside of the input region", + }, + ), + ), + ( + "window_function", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--window_function %s", + "help_string": "Window Function \nh = Hamming \nc = Cosine \nw = Welch \nl = Lanczos \nb = Blackman", + }, + ), + ), + ( + "spline_order", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--spline_order %d", + "help_string": "Spline Order (Spline order may be from 0 to 5)", + }, + ), + ), + ( + "transform_matrix", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--transform_matrix %s", + "help_string": "12 parameters of the transform matrix by rows ( --last 3 being translation-- )", + "sep": ",", + }, + ), + ), + ( + "transform", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transform %s", + "help_string": "Transform algorithm\nrt = Rigid Transform\na = Affine Transform", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Resampled Volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ResampleDTIVolume", + executable=" ResampleDTIVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/__init__.py b/pydra/tasks/sem/filtering/__init__.py new file mode 100644 index 0000000..a207ded --- /dev/null +++ b/pydra/tasks/sem/filtering/__init__.py @@ -0,0 +1,21 @@ +from arithmetic import ( + AddScalarVolumes, + CastScalarVolume, + MaskScalarVolume, + MultiplyScalarVolumes, + SubtractScalarVolumes, +) +from denoising import ( + CurvatureAnisotropicDiffusion, + GaussianBlurImageFilter, + GradientAnisotropicDiffusion, + MedianImageFilter, +) +from morphology import GrayscaleFillHoleImageFilter, GrayscaleGrindPeakImageFilter +from checkerboardfilter import CheckerBoardFilter +from histogrammatching import HistogramMatching +from imagelabelcombine import ImageLabelCombine +from n4itkbiasfieldcorrection import N4ITKBiasFieldCorrection +from resamplescalarvectordwivolume import ResampleScalarVectorDWIVolume +from thresholdscalarvolume import ThresholdScalarVolume +from votingbinaryholefillingimagefilter import VotingBinaryHoleFillingImageFilter diff --git a/pydra/tasks/sem/filtering/arithmetic.py b/pydra/tasks/sem/filtering/arithmetic.py new file mode 100644 index 0000000..79449d9 --- /dev/null +++ b/pydra/tasks/sem/filtering/arithmetic.py @@ -0,0 +1,433 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class AddScalarVolumes: + """ + title: Add Scalar Volumes + category: Filtering.Arithmetic + description: Adds two images. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions. + version: 0.1.0.$Revision$(alpha) + documentation-url: https://www.slicer.org/wiki/Documentation/Nightly/Modules/Add + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 1", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "inputVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 2", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Volume1 + Volume2", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "order", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--order %s", + "help_string": "Interpolation order if two images are in different coordinate frames or have different sampling.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Volume1 + Volume2", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="AddScalarVolumes", + executable=" AddScalarVolumes ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class CastScalarVolume: + """ + title: Cast Scalar Volume + category: Filtering.Arithmetic + description: Cast a volume to a given data type.\nUse at your own risk when casting an input volume into a lower precision type!\nAllows casting to the same type as the input volume. + version: 0.1.0.$Revision: 2104 $(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/Cast + contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "InputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume, the volume to cast.", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output volume, cast to the new type.", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "type", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--type %s", + "help_string": "Scalar data type for the new output volume.", + }, + ), + ), + ] + output_fields = [ + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output volume, cast to the new type.", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="CastScalarVolume", + executable=" CastScalarVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class MaskScalarVolume: + """ + title: Mask Scalar Volume + category: Filtering.Arithmetic + description: Masks two images. The output image is set to 0 everywhere except where the chosen label from the mask volume is present, at which point it will retain it's original values. The two images do not have to have the same dimensions. + version: 0.1.0.$Revision: 8595 $(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/Mask + contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "InputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be masked", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "MaskVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Label volume containing the mask", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output volume: Input Volume masked by label value from Mask Volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "label", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--label %d", + "help_string": "Label value in the Mask Volume to use as the mask", + }, + ), + ), + ( + "replace", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--replace %d", + "help_string": "Value to use for the output volume outside of the mask", + }, + ), + ), + ] + output_fields = [ + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output volume: Input Volume masked by label value from Mask Volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="MaskScalarVolume", + executable=" MaskScalarVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class MultiplyScalarVolumes: + """ + title: Multiply Scalar Volumes + category: Filtering.Arithmetic + description: Multiplies two images. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions. + version: 0.1.0.$Revision: 8595 $(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/Multiply + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 1", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "inputVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 2", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Volume1 * Volume2", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "order", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--order %s", + "help_string": "Interpolation order if two images are in different coordinate frames or have different sampling.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Volume1 * Volume2", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="MultiplyScalarVolumes", + executable=" MultiplyScalarVolumes ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class SubtractScalarVolumes: + """ + title: Subtract Scalar Volumes + category: Filtering.Arithmetic + description: Subtracts two images. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/Subtract + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 1", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "inputVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume 2", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Volume1 - Volume2", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "order", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--order %s", + "help_string": "Interpolation order if two images are in different coordinate frames or have different sampling.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Volume1 - Volume2", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="SubtractScalarVolumes", + executable=" SubtractScalarVolumes ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/checkerboardfilter.py b/pydra/tasks/sem/filtering/checkerboardfilter.py new file mode 100644 index 0000000..7ebcb4d --- /dev/null +++ b/pydra/tasks/sem/filtering/checkerboardfilter.py @@ -0,0 +1,100 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class CheckerBoardFilter: + """ + title: CheckerBoard Filter + category: Filtering + description: Create a checkerboard volume of two volumes. The output volume will show the two inputs alternating according to the user supplied checkerPattern. This filter is often used to compare the results of image registration. Note that the second input is resampled to the same origin, spacing and direction before it is composed with the first input. The scalar type of the output volume will be the same as the input image scalar type. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/CheckerBoard + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "checkerPattern", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--checkerPattern %s", + "help_string": "The pattern of input 1 and input 2 in the output image. The user can specify the number of checkers in each dimension. A checkerPattern of 2,2,1 means that images will alternate in every other checker in the first two dimensions. The same pattern will be used in the 3rd dimension.", + "sep": ",", + }, + ), + ), + ( + "inputVolume1", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "First Input volume", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "inputVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Second Input volume", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="CheckerBoardFilter", + executable=" CheckerBoardFilter ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/denoising.py b/pydra/tasks/sem/filtering/denoising.py new file mode 100644 index 0000000..15cdbb5 --- /dev/null +++ b/pydra/tasks/sem/filtering/denoising.py @@ -0,0 +1,354 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class CurvatureAnisotropicDiffusion: + """ + title: Curvature Anisotropic Diffusion + category: Filtering.Denoising + description: Performs anisotropic diffusion on an image using a modified curvature diffusion equation (MCDE).\n\nMCDE does not exhibit the edge enhancing properties of classic anisotropic diffusion, which can under certain conditions undergo a 'negative' diffusion, which enhances the contrast of edges. Equations of the form of MCDE always undergo positive diffusion, with the conductance term only varying the strength of that diffusion. \n\n Qualitatively, MCDE compares well with other non-linear diffusion techniques. It is less sensitive to contrast than classic Perona-Malik style diffusion, and preserves finer detailed structures in images. There is a potential speed trade-off for using this function in place of Gradient Anisotropic Diffusion. Each iteration of the solution takes roughly twice as long. Fewer iterations, however, may be required to reach an acceptable solution. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/CurvatureAnisotropicDiffusion + contributor: Bill Lorensen (GE) + acknowledgements: This command module was derived from Insight/Examples (copyright) Insight Software Consortium + """ + + input_fields = [ + ( + "conductance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--conductance %f", + "help_string": "Conductance controls the sensitivity of the conductance term. As a general rule, the lower the value, the more strongly the filter preserves edges. A high value will cause diffusion (smoothing) across edges. Note that the number of iterations controls how much smoothing is done within regions bounded by edges.", + }, + ), + ), + ( + "iterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--iterations %d", + "help_string": "The more iterations, the more smoothing. Each iteration takes the same amount of time. If it takes 10 seconds for one iteration, then it will take 100 seconds for 10 iterations. Note that the conductance controls how much each iteration smooths across edges.", + }, + ), + ), + ( + "timeStep", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--timeStep %f", + "help_string": "The time step depends on the dimensionality of the image. In Slicer the images are 3D and the default (.0625) time step will provide a stable solution.", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="CurvatureAnisotropicDiffusion", + executable=" CurvatureAnisotropicDiffusion ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class GaussianBlurImageFilter: + """ + title: Gaussian Blur Image Filter + category: Filtering.Denoising + description: Apply a gaussian blurr to an image + version: 0.1.0.$Revision: 1.1 $(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/GaussianBlurImageFilter + contributor: Julien Jomier (Kitware), Stephen Aylward (Kitware) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "sigma", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--sigma %f", + "help_string": "Sigma value in physical units (e.g., mm) of the Gaussian kernel", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Blurred Volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Blurred Volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GaussianBlurImageFilter", + executable=" GaussianBlurImageFilter ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class GradientAnisotropicDiffusion: + """ + title: Gradient Anisotropic Diffusion + category: Filtering.Denoising + description: Runs gradient anisotropic diffusion on a volume.\n\nAnisotropic diffusion methods reduce noise (or unwanted detail) in images while preserving specific image features, like edges. For many applications, there is an assumption that light-dark transitions (edges) are interesting. Standard isotropic diffusion methods move and blur light-dark boundaries. Anisotropic diffusion methods are formulated to specifically preserve edges. The conductance term for this implementation is a function of the gradient magnitude of the image at each point, reducing the strength of diffusion at edges. The numerical implementation of this equation is similar to that described in the Perona-Malik paper, but uses a more robust technique for gradient magnitude estimation and has been generalized to N-dimensions. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/GradientAnisotropicDiffusion + contributor: Bill Lorensen (GE) + acknowledgements: This command module was derived from Insight/Examples (copyright) Insight Software Consortium + """ + + input_fields = [ + ( + "conductance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--conductance %f", + "help_string": "Conductance controls the sensitivity of the conductance term. As a general rule, the lower the value, the more strongly the filter preserves edges. A high value will cause diffusion (smoothing) across edges. Note that the number of iterations controls how much smoothing is done within regions bounded by edges.", + }, + ), + ), + ( + "iterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--iterations %d", + "help_string": "The more iterations, the more smoothing. Each iteration takes the same amount of time. If it takes 10 seconds for one iteration, then it will take 100 seconds for 10 iterations. Note that the conductance controls how much each iteration smooths across edges.", + }, + ), + ), + ( + "timeStep", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--timeStep %f", + "help_string": "The time step depends on the dimensionality of the image. In Slicer the images are 3D and the default (.0625) time step will provide a stable solution.", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "useImageSpacing", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useImageSpacing ", + "help_string": "![CDATA[Take into account image spacing in the computation. It is advisable to turn this option on, especially when the pixel size is different in different dimensions. However, to produce results consistent with Slicer4.2 and earlier, this option should be turned off.]]", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GradientAnisotropicDiffusion", + executable=" GradientAnisotropicDiffusion ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class MedianImageFilter: + """ + title: Median Image Filter + category: Filtering.Denoising + description: The MedianImageFilter is commonly used as a robust approach for noise reduction. This filter is particularly efficient against "salt-and-pepper" noise. In other words, it is robust to the presence of gray-level outliers. MedianImageFilter computes the value of each output pixel as the statistical median of the neighborhood of values around the corresponding input pixel. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/MedianImageFilter + contributor: Bill Lorensen (GE) + acknowledgements: This command module was derived from Insight/Examples/Filtering/MedianImageFilter (copyright) Insight Software Consortium + """ + + input_fields = [ + ( + "neighborhood", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--neighborhood %s", + "help_string": "The size of the neighborhood in each dimension", + "sep": ",", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="MedianImageFilter", + executable=" MedianImageFilter ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/histogrammatching.py b/pydra/tasks/sem/filtering/histogrammatching.py new file mode 100644 index 0000000..b2c2931 --- /dev/null +++ b/pydra/tasks/sem/filtering/histogrammatching.py @@ -0,0 +1,119 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class HistogramMatching: + """ + title: Histogram Matching + category: Filtering + description: Normalizes the grayscale values of a source image based on the grayscale values of a reference image. This filter uses a histogram matching technique where the histograms of the two images are matched only at a specified number of quantile values.\n\nThe filter was originally designed to normalize MR images of the sameMR protocol and same body part. The algorithm works best if background pixels are excluded from both the source and reference histograms. A simple background exclusion method is to exclude all pixels whose grayscale values are smaller than the mean grayscale value. ThresholdAtMeanIntensity switches on this simple background exclusion method.\n\nNumber of match points governs the number of quantile values to be matched.\n\nThe filter assumes that both the source and reference are of the same type and that the input and output image type have the same number of dimension and have scalar pixel types. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/HistogramMatching + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "numberOfHistogramLevels", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfHistogramLevels %d", + "help_string": "The number of hisogram levels to use", + }, + ), + ), + ( + "numberOfMatchPoints", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfMatchPoints %d", + "help_string": "The number of match points to use", + }, + ), + ), + ( + "threshold", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--threshold ", + "help_string": "If on, only pixels above the mean in each volume are thresholded.", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "referenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume whose histogram will be matched", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output volume. This is the input volume with intensities matched to the reference volume.", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output volume. This is the input volume with intensities matched to the reference volume.", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="HistogramMatching", + executable=" HistogramMatching ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/imagelabelcombine.py b/pydra/tasks/sem/filtering/imagelabelcombine.py new file mode 100644 index 0000000..df02d32 --- /dev/null +++ b/pydra/tasks/sem/filtering/imagelabelcombine.py @@ -0,0 +1,98 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class ImageLabelCombine: + """ + title: Image Label Combine + category: Filtering + description: Combine two label maps into one + version: 0.1.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ImageLabelCombine + contributor: Alex Yarmarkovich (SPL, BWH) + """ + + input_fields = [ + ( + "InputLabelMap_A", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Label map image", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "InputLabelMap_B", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Label map image", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "OutputLabelMap", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Resulting Label map image", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "first_overwrites", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--first_overwrites ", + "help_string": "Use first or second label when both are present", + }, + ), + ), + ] + output_fields = [ + ( + "OutputLabelMap", + attr.ib( + type=File, + metadata={ + "help_string": "Resulting Label map image", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ImageLabelCombine", + executable=" ImageLabelCombine ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/morphology.py b/pydra/tasks/sem/filtering/morphology.py new file mode 100644 index 0000000..239d821 --- /dev/null +++ b/pydra/tasks/sem/filtering/morphology.py @@ -0,0 +1,139 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class GrayscaleFillHoleImageFilter: + """ + title: Grayscale Fill Hole Image Filter + category: Filtering.Morphology + description: GrayscaleFillholeImageFilter fills holes in a grayscale image. Holes are local minima in the grayscale topography that are not connected to boundaries of the image. Gray level values adjacent to a hole are extrapolated across the hole.\n\nThis filter is used to smooth over local minima without affecting the values of local maxima. If you take the difference between the output of this filter and the original image (and perhaps threshold the difference above a small value), you'll obtain a map of the local minima.\n\nThis filter uses the itkGrayscaleGeodesicErodeImageFilter. It provides its own input as the "mask" input to the geodesic erosion. The "marker" image for the geodesic erosion is constructed such that boundary pixels match the boundary pixels of the input image and the interior pixels are set to the maximum pixel value in the input image.\n\n Geodesic morphology and the Fillhole algorithm is described in Chapter 6 of Pierre Soille's book "Morphological Image Analysis: Principles and Applications", Second Edition, Springer, 2003. \n\n A companion filter, Grayscale Grind Peak, removes peaks in grayscale images. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/GrayscaleFillHoleImageFilter + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GrayscaleFillHoleImageFilter", + executable=" GrayscaleFillHoleImageFilter ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class GrayscaleGrindPeakImageFilter: + """ + title: Grayscale Grind Peak Image Filter + category: Filtering.Morphology + description: GrayscaleGrindPeakImageFilter removes peaks in a grayscale image. Peaks are local maxima in the grayscale topography that are not connected to boundaries of the image. Gray level values adjacent to a peak are extrapolated through the peak.\n\nThis filter is used to smooth over local maxima without affecting the values of local minima. If you take the difference between the output of this filter and the original image (and perhaps threshold the difference above a small value), you'll obtain a map of the local maxima.\n\nThis filter uses the GrayscaleGeodesicDilateImageFilter. It provides its own input as the "mask" input to the geodesic erosion. The "marker" image for the geodesic erosion is constructed such that boundary pixels match the boundary pixels of the input image and the interior pixels are set to the minimum pixel value in the input image.\n\nThis filter is the dual to the GrayscaleFillholeImageFilter which implements the Fillhole algorithm. Since it is a dual, it is somewhat superfluous but is provided as a convenience.\n\nGeodesic morphology and the Fillhole algorithm is described in Chapter 6 of Pierre Soille's book "Morphological Image Analysis: Principles and Applications", Second Edition, Springer, 2003.\n\nA companion filter, Grayscale Fill Hole, fills holes in grayscale images. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/GrayscaleGrindPeakImageFilter + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GrayscaleGrindPeakImageFilter", + executable=" GrayscaleGrindPeakImageFilter ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/n4itkbiasfieldcorrection.py b/pydra/tasks/sem/filtering/n4itkbiasfieldcorrection.py new file mode 100644 index 0000000..13c7581 --- /dev/null +++ b/pydra/tasks/sem/filtering/n4itkbiasfieldcorrection.py @@ -0,0 +1,212 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class N4ITKBiasFieldCorrection: + """ + title: N4ITK MRI Bias correction + category: Filtering + description: Performs image bias correction using N4 algorithm. This module is based on the ITK filters contributed in the following publication: Tustison N, Gee J "N4ITK: Nick's N3 ITK Implementation For MRI Bias Field Correction", The Insight Journal 2009 January-June, http://hdl.handle.net/10380/3053 + version: 9 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/N4ITKBiasFieldCorrection + contributor: Nick Tustison (UPenn), Andrey Fedorov (SPL, BWH), Ron Kikinis (SPL, BWH) + acknowledgements: The development of this module was partially supported by NIH grants R01 AA016748-01, R01 CA111288 and U01 CA151261 as well as by NA-MIC, NAC, NCIGT and the Slicer community. + """ + + input_fields = [ + ( + "inputImageName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input image where you observe signal inhomegeneity", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "maskimage", + attr.ib( + type=File, + metadata={ + "argstr": "--maskimage %s", + "help_string": "Binary mask that defines the structure of your interest. NOTE: This parameter is OPTIONAL. If the mask is not specified, the module will use internally Otsu thresholding to define this mask. Better processing results can often be obtained when a meaningful mask is defined.", + "exists": "True", + }, + ), + ), + ( + "outputImageName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Result of processing", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "outputbiasfield", + attr.ib( + type=File, + metadata={ + "argstr": "--outputbiasfield %s", + "help_string": "Recovered bias field (OPTIONAL)", + "hash_files": "False", + }, + ), + ), + ( + "meshresolution", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--meshresolution %s", + "help_string": "Resolution of the initial bspline grid defined as a sequence of three numbers. The actual resolution will be defined by adding the bspline order (default is 3) to the resolution in each dimension specified here. For example, 1,1,1 will result in a 4x4x4 grid of control points. This parameter may need to be adjusted based on your input image. In the multi-resolution N4 framework, the resolution of the bspline grid at subsequent iterations will be doubled. The number of resolutions is implicitly defined by Number of iterations parameter (the size of this list is the number of resolutions)", + "sep": ",", + }, + ), + ), + ( + "splinedistance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--splinedistance %f", + "help_string": "An alternative means to define the spline grid, by setting the distance between the control points. This parameter is used only if the grid resolution is not specified.", + }, + ), + ), + ( + "bffwhm", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--bffwhm %f", + "help_string": "Bias field Full Width at Half Maximum. Zero implies use of the default value.", + }, + ), + ), + ( + "iterations", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--iterations %s", + "help_string": "Maximum number of iterations at each level of resolution. Larger values will increase execution time, but may lead to better results.", + "sep": ",", + }, + ), + ), + ( + "convergencethreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--convergencethreshold %f", + "help_string": "Stopping criterion for the iterative bias estimation. Larger values will lead to smaller execution time.", + }, + ), + ), + ( + "bsplineorder", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--bsplineorder %d", + "help_string": "Order of B-spline used in the approximation. Larger values will lead to longer execution times, may result in overfitting and poor result.", + }, + ), + ), + ( + "shrinkfactor", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--shrinkfactor %d", + "help_string": "Defines how much the image should be upsampled before estimating the inhomogeneity field. Increase if you want to reduce the execution time. 1 corresponds to the original resolution. Larger values will significantly reduce the computation time.", + }, + ), + ), + ( + "weightimage", + attr.ib( + type=File, + metadata={ + "argstr": "--weightimage %s", + "help_string": "Weight Image", + "exists": "True", + }, + ), + ), + ( + "wienerfilternoise", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--wienerfilternoise %f", + "help_string": "Wiener filter noise. Zero implies use of the default value.", + }, + ), + ), + ( + "nhistogrambins", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--nhistogrambins %d", + "help_string": "Number of histogram bins. Zero implies use of the default value.", + }, + ), + ), + ] + output_fields = [ + ( + "outputImageName", + attr.ib( + type=File, + metadata={ + "help_string": "Result of processing", + "position": "-1", + "exists": "True", + }, + ), + ), + ( + "outputbiasfield", + attr.ib( + type=File, + metadata={ + "help_string": "Recovered bias field (OPTIONAL)", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="N4ITKBiasFieldCorrection", + executable=" N4ITKBiasFieldCorrection ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/resamplescalarvectordwivolume.py b/pydra/tasks/sem/filtering/resamplescalarvectordwivolume.py new file mode 100644 index 0000000..059604d --- /dev/null +++ b/pydra/tasks/sem/filtering/resamplescalarvectordwivolume.py @@ -0,0 +1,297 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class ResampleScalarVectorDWIVolume: + """ + title: Resample Scalar/Vector/DWI Volume + category: Filtering + description: This module implements image and vector-image resampling through the use of itk Transforms.It can also handle diffusion weighted MRI image resampling. "Resampling" is performed in space coordinates, not pixel/grid coordinates. It is quite important to ensure that image spacing is properly set on the images involved. The interpolator is required since the mapping from one space to the other will often require evaluation of the intensity of the image at non-grid positions. \n\nWarning: To resample DWMR Images, use nrrd input and output files. \n\nWarning: Do not use to resample Diffusion Tensor Images, tensors would not be reoriented + version: 0.1 + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ResampleScalarVectorDWIVolume + contributor: Francois Budin (UNC) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. Information on the National Centers for Biomedical Computing can be obtained from http://nihroadmap.nih.gov/bioinformatics + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input Volume to be resampled", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Resampled Volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "Reference", + attr.ib( + type=File, + metadata={ + "argstr": "--Reference %s", + "help_string": "Reference Volume (spacing,size,orientation,origin)", + "exists": "True", + }, + ), + ), + ( + "transformationFile", + attr.ib( + type=File, + metadata={"argstr": "--transformationFile %s", "exists": "True"}, + ), + ), + ( + "defField", + attr.ib( + type=File, + metadata={ + "argstr": "--defField %s", + "help_string": "File containing the deformation field (3D vector image containing vectors with 3 components)", + "exists": "True", + }, + ), + ), + ( + "hfieldtype", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--hfieldtype %s", + "help_string": "Set if the deformation field is an h-Field", + }, + ), + ), + ( + "interpolation", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolation %s", + "help_string": "Sampling algorithm (linear or nn (nearest neighborhoor), ws (WindowedSinc), bs (BSpline) )", + }, + ), + ), + ( + "transform_order", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transform_order %s", + "help_string": "Select in what order the transforms are read", + }, + ), + ), + ( + "notbulk", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--notbulk ", + "help_string": "The transform following the BSpline transform is not set as a bulk transform for the BSpline transform", + }, + ), + ), + ( + "spaceChange", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--spaceChange ", + "help_string": "Space Orientation between transform and image is different (RAS/LPS) (warning: if the transform is a Transform Node in Slicer3, do not select)", + }, + ), + ), + ( + "rotation_point", + attr.ib( + type=traits.List, + metadata={ + "argstr": "--rotation_point %s", + "help_string": "Rotation Point in case of rotation around a point (otherwise useless)", + }, + ), + ), + ( + "centered_transform", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--centered_transform ", + "help_string": "Set the center of the transformation to the center of the input image", + }, + ), + ), + ( + "image_center", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--image_center %s", + "help_string": "Image to use to center the transform (used only if 'Centered Transform' is selected)", + }, + ), + ), + ( + "Inverse_ITK_Transformation", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--Inverse_ITK_Transformation ", + "help_string": "Inverse the transformation before applying it from output image to input image", + }, + ), + ), + ( + "spacing", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--spacing %s", + "help_string": "Spacing along each dimension (0 means use input spacing)", + "sep": ",", + }, + ), + ), + ( + "size", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--size %s", + "help_string": "Size along each dimension (0 means use input size)", + "sep": ",", + }, + ), + ), + ( + "origin", + attr.ib( + type=traits.List, + metadata={ + "argstr": "--origin %s", + "help_string": "Origin of the output Image", + }, + ), + ), + ( + "direction_matrix", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--direction_matrix %s", + "help_string": "9 parameters of the direction matrix by rows (ijk to LPS if LPS transform, ijk to RAS if RAS transform)", + "sep": ",", + }, + ), + ), + ( + "number_of_thread", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--number_of_thread %d", + "help_string": "Number of thread used to compute the output image", + }, + ), + ), + ( + "default_pixel_value", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--default_pixel_value %f", + "help_string": "Default pixel value for samples falling outside of the input region", + }, + ), + ), + ( + "window_function", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--window_function %s", + "help_string": "Window Function \nh = Hamming \nc = Cosine \nw = Welch \nl = Lanczos \nb = Blackman", + }, + ), + ), + ( + "spline_order", + attr.ib( + type=traits.Int, + metadata={"argstr": "--spline_order %d", "help_string": "Spline Order"}, + ), + ), + ( + "transform_matrix", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--transform_matrix %s", + "help_string": "12 parameters of the transform matrix by rows ( --last 3 being translation-- )", + "sep": ",", + }, + ), + ), + ( + "transform", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transform %s", + "help_string": "Transform algorithm\nrt = Rigid Transform\na = Affine Transform", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Resampled Volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ResampleScalarVectorDWIVolume", + executable=" ResampleScalarVectorDWIVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/thresholdscalarvolume.py b/pydra/tasks/sem/filtering/thresholdscalarvolume.py new file mode 100644 index 0000000..3031d24 --- /dev/null +++ b/pydra/tasks/sem/filtering/thresholdscalarvolume.py @@ -0,0 +1,134 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class ThresholdScalarVolume: + """ + title: Threshold Scalar Volume + category: Filtering + description:
Threshold an image.
Set image values to a user-specified outside value if they are below, above, or between simple threshold values.
ThresholdAbove: The values greater than or equal to the threshold value are set to OutsideValue.
ThresholdBelow: The values less than or equal to the threshold value are set to OutsideValue.
ThresholdOutside: The values outside the range Lower-Upper are set to OutsideValue.
+ version: 0.1.0.$Revision: 2104 $(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/Threshold + contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH), Julien Finet (Kitware) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "InputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Thresholded input volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "thresholdtype", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--thresholdtype %s", + "help_string": "What kind of threshold to perform. If Outside is selected, uses Upper and Lower values. If Below is selected, uses the ThresholdValue, if Above is selected, uses the ThresholdValue.", + }, + ), + ), + ( + "threshold", + attr.ib( + type=traits.Float, + metadata={"argstr": "--threshold %f", "help_string": "Threshold value"}, + ), + ), + ( + "lower", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--lower %f", + "help_string": "Lower threshold value", + }, + ), + ), + ( + "upper", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--upper %f", + "help_string": "Upper threshold value", + }, + ), + ), + ( + "outsidevalue", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--outsidevalue %f", + "help_string": "Set the voxels to this value if they fall outside the threshold range", + }, + ), + ), + ( + "negate", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--negate ", + "help_string": "Swap the outside value with the inside value.", + }, + ), + ), + ] + output_fields = [ + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Thresholded input volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ThresholdScalarVolume", + executable=" ThresholdScalarVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/filtering/votingbinaryholefillingimagefilter.py b/pydra/tasks/sem/filtering/votingbinaryholefillingimagefilter.py new file mode 100644 index 0000000..61961ad --- /dev/null +++ b/pydra/tasks/sem/filtering/votingbinaryholefillingimagefilter.py @@ -0,0 +1,118 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class VotingBinaryHoleFillingImageFilter: + """ + title: Voting Binary Hole Filling Image Filter + category: Filtering + description: Applies a voting operation in order to fill-in cavities. This can be used for smoothing contours and for filling holes in binary images. This technique is used frequently when segmenting complete organs that may have ducts or vasculature that may not have been included in the initial segmentation, e.g. lungs, kidneys, liver. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/VotingBinaryHoleFillingImageFilter + contributor: Bill Lorensen (GE) + acknowledgements: This command module was derived from Insight/Examples/Filtering/VotingBinaryHoleFillingImageFilter (copyright) Insight Software Consortium + """ + + input_fields = [ + ( + "radius", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--radius %s", + "help_string": "The radius of a hole to be filled", + "sep": ",", + }, + ), + ), + ( + "majorityThreshold", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--majorityThreshold %d", + "help_string": "The number of pixels over 50% that will decide whether an OFF pixel will become ON or not. For example, if the neighborhood of a pixel has 124 pixels (excluding itself), the 50% will be 62, and if you set a Majority threshold of 5, that means that the filter will require 67 or more neighbor pixels to be ON in order to switch the current OFF pixel to ON.", + }, + ), + ), + ( + "background", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--background %d", + "help_string": "The value associated with the background (not object)", + }, + ), + ), + ( + "foreground", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--foreground %d", + "help_string": "The value associated with the foreground (object)", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="VotingBinaryHoleFillingImageFilter", + executable=" VotingBinaryHoleFillingImageFilter ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/legacy/__init__.py b/pydra/tasks/sem/legacy/__init__.py new file mode 100644 index 0000000..fc3aa14 --- /dev/null +++ b/pydra/tasks/sem/legacy/__init__.py @@ -0,0 +1,3 @@ +from work import DiffusionTensorTest +from registration import ExpertAutomatedRegistration, TestGridTransformRegistration +from filtering import ResampleScalarVolume diff --git a/pydra/tasks/sem/legacy/filtering.py b/pydra/tasks/sem/legacy/filtering.py new file mode 100644 index 0000000..fef24a4 --- /dev/null +++ b/pydra/tasks/sem/legacy/filtering.py @@ -0,0 +1,98 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class ResampleScalarVolume: + """ + title: Resample Scalar Volume + category: Legacy.Filtering + description: Resampling an image is an important task in image analysis. It is especially important in the frame of image registration. This module implements image resampling through the use of itk Transforms. This module uses an Identity Transform. The resampling is controlled by the Output Spacing. "Resampling" is performed in space coordinates, not pixel/grid coordinates. It is quite important to ensure that image spacing is properly set on the images involved. The interpolator is required since the mapping from one space to the other will often require evaluation of the intensity of the image at non-grid positions. Several interpolators are available: linear, nearest neighbor, bspline and five flavors of sinc. The sinc interpolators, although more precise, are much slower than the linear and nearest neighbor interpolator. To resample label volumnes, nearest neighbor interpolation should be used exclusively. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ResampleVolume + contributor: Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "spacing", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--spacing %s", + "help_string": "Spacing along each dimension (0 means use input spacing)", + "sep": ",", + }, + ), + ), + ( + "interpolation", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolation %s", + "help_string": "Sampling algorithm (linear, nearest neighbor, bspline(cubic) or windowed sinc). There are several sinc algorithms available as described in the following publication: Erik H. W. Meijering, Wiro J. Niessen, Josien P. W. Pluim, Max A. Viergever: Quantitative Comparison of Sinc-Approximating Kernels for Medical Image Interpolation. MICCAI 1999, pp. 210-217. Each window has a radius of 3;", + }, + ), + ), + ( + "InputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be resampled", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Resampled Volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "OutputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Resampled Volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ResampleScalarVolume", + executable=" ResampleScalarVolume ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/legacy/registration.py b/pydra/tasks/sem/legacy/registration.py new file mode 100644 index 0000000..d416026 --- /dev/null +++ b/pydra/tasks/sem/legacy/registration.py @@ -0,0 +1,429 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class ExpertAutomatedRegistration: + """ + title: Expert Automated Registration + category: Legacy.Registration + description: Provides rigid, affine, and BSpline registration methods via a simple GUI + version: 0.1.0.$Revision: 2104 $(alpha) + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ExpertAutomatedRegistration + contributor: Stephen R Aylward (Kitware), Casey B Goodlett (Kitware) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "fixedImage", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Image which defines the space into which the moving image is registered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "movingImage", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "The transform goes from the fixed image's space into the moving image's space", + "position": "-1", + "exists": "True", + }, + ), + ), + ( + "resampledImage", + attr.ib( + type=File, + metadata={ + "argstr": "--resampledImage %s", + "help_string": "Registration results", + "hash_files": "False", + }, + ), + ), + ( + "loadTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--loadTransform %s", + "help_string": "Load a transform that is immediately applied to the moving image", + "exists": "True", + }, + ), + ), + ( + "saveTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--saveTransform %s", + "help_string": "Save the transform that results from registration", + "hash_files": "False", + }, + ), + ), + ( + "initialization", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--initialization %s", + "help_string": "Method to prime the registration process", + }, + ), + ), + ( + "registration", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--registration %s", + "help_string": "Method for the registration process", + }, + ), + ), + ( + "metric", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--metric %s", + "help_string": "Method to quantify image match", + }, + ), + ), + ( + "expectedOffset", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--expectedOffset %f", + "help_string": "Expected misalignment after initialization", + }, + ), + ), + ( + "expectedRotation", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--expectedRotation %f", + "help_string": "Expected misalignment after initialization", + }, + ), + ), + ( + "expectedScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--expectedScale %f", + "help_string": "Expected misalignment after initialization", + }, + ), + ), + ( + "expectedSkew", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--expectedSkew %f", + "help_string": "Expected misalignment after initialization", + }, + ), + ), + ( + "verbosityLevel", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--verbosityLevel %s", + "help_string": "Level of detail of reporting progress", + }, + ), + ), + ( + "sampleFromOverlap", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--sampleFromOverlap ", + "help_string": "Limit metric evaluation to the fixed image region overlapped by the moving image", + }, + ), + ), + ( + "fixedImageMask", + attr.ib( + type=File, + metadata={ + "argstr": "--fixedImageMask %s", + "help_string": "Image which defines a mask for the fixed image", + "exists": "True", + }, + ), + ), + ( + "randomNumberSeed", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--randomNumberSeed %d", + "help_string": "Seed to generate a consistent random number sequence", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Number of CPU threads to use", + }, + ), + ), + ( + "minimizeMemory", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--minimizeMemory ", + "help_string": "Reduce the amount of memory required at the cost of increased computation time", + }, + ), + ), + ( + "interpolation", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolation %s", + "help_string": "Method for interpolation within the optimization process", + }, + ), + ), + ( + "fixedLandmarks", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--fixedLandmarks %s...", + "help_string": "Ordered list of landmarks in the fixed image", + }, + ), + ), + ( + "movingLandmarks", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--movingLandmarks %s...", + "help_string": "Ordered list of landmarks in the moving image", + }, + ), + ), + ( + "rigidMaxIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--rigidMaxIterations %d", + "help_string": "Maximum number of rigid optimization iterations", + }, + ), + ), + ( + "rigidSamplingRatio", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rigidSamplingRatio %f", + "help_string": "Portion of the image to use in computing the metric during rigid registration", + }, + ), + ), + ( + "affineMaxIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--affineMaxIterations %d", + "help_string": "Maximum number of affine optimization iterations", + }, + ), + ), + ( + "affineSamplingRatio", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--affineSamplingRatio %f", + "help_string": "Portion of the image to use in computing the metric during affine registration", + }, + ), + ), + ( + "bsplineMaxIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--bsplineMaxIterations %d", + "help_string": "Maximum number of bspline optimization iterations", + }, + ), + ), + ( + "bsplineSamplingRatio", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--bsplineSamplingRatio %f", + "help_string": "Portion of the image to use in computing the metric during BSpline registration", + }, + ), + ), + ( + "controlPointSpacing", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--controlPointSpacing %d", + "help_string": "Number of pixels between control points", + }, + ), + ), + ] + output_fields = [ + ( + "resampledImage", + attr.ib( + type=File, + metadata={"help_string": "Registration results", "exists": "True"}, + ), + ), + ( + "saveTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Save the transform that results from registration", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ExpertAutomatedRegistration", + executable=" ExpertAutomatedRegistration ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class TestGridTransformRegistration: + """ + title: Test GridTransform registration + category: Legacy.Registration + description: Generates a GridTransform to test the communication facilities + version: 0.1.0.$Revision: 6760 $(alpha) + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/TestGridTransformRegistration + contributor: Yinglin Lee (SPL, BWH) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "gridSize", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--gridSize %d", + "help_string": "Number of grid points on interior of image.", + }, + ), + ), + ( + "outputtransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputtransform %s", + "help_string": "The grid transform (deformation vector field).", + "hash_files": "False", + }, + ), + ), + ( + "FixedImageFileName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Fixed image to which to register", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "MovingImageFileName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Moving image", + "position": "-1", + "exists": "True", + }, + ), + ), + ] + output_fields = [ + ( + "outputtransform", + attr.ib( + type=File, + metadata={ + "help_string": "The grid transform (deformation vector field).", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="TestGridTransformRegistration", + executable=" TestGridTransformRegistration ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/legacy/work.py b/pydra/tasks/sem/legacy/work.py new file mode 100644 index 0000000..ab2b14e --- /dev/null +++ b/pydra/tasks/sem/legacy/work.py @@ -0,0 +1,75 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class DiffusionTensorTest: + """ + title: Simple IO Test + category: Legacy.Work in Progress.Diffusion Tensor.Test + description: Simple test of tensor IO + version: 0.1.0.$Revision$(alpha) + contributor: Bill Lorensen (GE) + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input tensor volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Filtered tensor volume", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Filtered tensor volume", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="DiffusionTensorTest", + executable=" DiffusionTensorTest ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/quantification.py b/pydra/tasks/sem/quantification.py new file mode 100644 index 0000000..cb93f8e --- /dev/null +++ b/pydra/tasks/sem/quantification.py @@ -0,0 +1,289 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSLabelStats: + """ + title: Label Statistics (BRAINS) + category: Quantification + description: Compute image statistics within each label of a label map. + version: 5.2.0 + documentation-url: http://www.nitrc.org/plugins/mwiki/index.php/brains:BRAINSClassify + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Vincent A. Magnotta + acknowledgements: Funding for this work was provided by the Dana Foundation + """ + + input_fields = [ + ( + "imageVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--imageVolume %s", + "help_string": "Image Volume", + "exists": "True", + }, + ), + ), + ( + "labelVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--labelVolume %s", + "help_string": "Label Volume", + "exists": "True", + }, + ), + ), + ( + "labelNameFile", + attr.ib( + type=File, + metadata={ + "argstr": "--labelNameFile %s", + "help_string": "Label Name File", + "exists": "True", + }, + ), + ), + ( + "outputPrefixColumnNames", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--outputPrefixColumnNames %s", + "help_string": "Prefix Column Name(s)", + "sep": ",", + }, + ), + ), + ( + "outputPrefixColumnValues", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--outputPrefixColumnValues %s", + "help_string": "Prefix Column Value(s)", + "sep": ",", + }, + ), + ), + ( + "labelFileType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--labelFileType %s", + "help_string": "Label File Type", + }, + ), + ), + ( + "numberOfHistogramBins", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfHistogramBins %d", + "help_string": "Number Of Histogram Bins", + }, + ), + ), + ( + "minMaxType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--minMaxType %s", + "help_string": "Define minimim and maximum values based upon the image, label, or via command line", + }, + ), + ), + ( + "userDefineMinimum", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--userDefineMinimum %f", + "help_string": "User define minimum value", + }, + ), + ), + ( + "userDefineMaximum", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--userDefineMaximum %f", + "help_string": "User define maximum value", + }, + ), + ), + ] + output_fields = [] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSLabelStats", + executable=" BRAINSLabelStats ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class PETStandardUptakeValueComputation: + """ + title: PET Standard Uptake Value Computation + category: Quantification + description: Computes the standardized uptake value based on body weight. Takes an input PET image in DICOM and NRRD format (DICOM header must contain Radiopharmaceutical parameters). Produces a CSV file that contains patientID, studyDate, dose, labelID, suvmin, suvmax, suvmean, labelName for each volume of interest. It also displays some of the information as output strings in the GUI, the CSV file is optional in that case. The CSV file is appended to on each execution of the CLI. + version: 0.1.0.$Revision: 8595 $(alpha) + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ComputeSUVBodyWeight + contributor: Wendy Plesniak (SPL, BWH), Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH) + acknowledgements: This work is funded by the Harvard Catalyst, and the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "petDICOMPath", + attr.ib( + type=Directory, + metadata={ + "argstr": "--petDICOMPath %s", + "help_string": "Input path to a directory containing a PET volume containing DICOM header information for SUV computation", + "exists": "True", + }, + ), + ), + ( + "petVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--petVolume %s", + "help_string": "Input PET volume for SUVbw computation (must be the same volume as pointed to by the DICOM path!).", + "exists": "True", + }, + ), + ), + ( + "labelMap", + attr.ib( + type=File, + metadata={ + "argstr": "--labelMap %s", + "help_string": "Input label volume containing the volumes of interest", + "exists": "True", + }, + ), + ), + ( + "color", + attr.ib( + type=File, + metadata={ + "argstr": "--color %s", + "help_string": "Color table to to map labels to colors and names", + "exists": "True", + }, + ), + ), + ( + "csvFile", + attr.ib( + type=File, + metadata={ + "argstr": "--csvFile %s", + "help_string": "A table holding the output SUV values in comma separated lines, one per label. Optional.", + "hash_files": "False", + }, + ), + ), + ( + "OutputLabel", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--OutputLabel %s", + "help_string": "List of labels for which SUV values were computed", + }, + ), + ), + ( + "OutputLabelValue", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--OutputLabelValue %s", + "help_string": "List of label values for which SUV values were computed", + }, + ), + ), + ( + "SUVMax", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--SUVMax %s", + "help_string": "SUV max for each label", + }, + ), + ), + ( + "SUVMean", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--SUVMean %s", + "help_string": "SUV mean for each label", + }, + ), + ), + ( + "SUVMin", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--SUVMin %s", + "help_string": "SUV minimum for each label", + }, + ), + ), + ] + output_fields = [ + ( + "csvFile", + attr.ib( + type=File, + metadata={ + "help_string": "A table holding the output SUV values in comma separated lines, one per label. Optional.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="PETStandardUptakeValueComputation", + executable=" PETStandardUptakeValueComputation ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/registration/__init__.py b/pydra/tasks/sem/registration/__init__.py new file mode 100644 index 0000000..ab74afb --- /dev/null +++ b/pydra/tasks/sem/registration/__init__.py @@ -0,0 +1,9 @@ +from specialized import ( + ACPCTransform, + BRAINSTransformFromFiducials, + FiducialRegistration, +) +from brainsfit import BRAINSFit +from brainsresample import BRAINSResample +from brainsresize import BRAINSResize +from performmetrictest import PerformMetricTest diff --git a/pydra/tasks/sem/registration/brainsfit.py b/pydra/tasks/sem/registration/brainsfit.py new file mode 100644 index 0000000..eebf3a6 --- /dev/null +++ b/pydra/tasks/sem/registration/brainsfit.py @@ -0,0 +1,797 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSFit: + """ + title: General Registration (BRAINS) + category: Registration + description: Register a three-dimensional volume to a reference volume (Mattes Mutual Information by default). Full documentation avalable here: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit. Method described in BRAINSFit: Mutual Information Registrations of Whole-Brain 3D Images, Using the Insight Toolkit, Johnson H.J., Harris G., Williams K., The Insight Journal, 2007. http://hdl.handle.net/1926/1291 + version: 5.2.0 + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSFit + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Hans J. Johnson (hans-johnson -at- uiowa.edu, http://www.psychiatry.uiowa.edu), Ali Ghayoor + acknowledgements: Hans Johnson(1,3,4); Kent Williams(1); Gregory Harris(1), Vincent Magnotta(1,2,3); Andriy Fedorov(5); Ali Ghayoor(4) 1=University of Iowa Department of Psychiatry, 2=University of Iowa Department of Radiology, 3=University of Iowa Department of Biomedical Engineering, 4=University of Iowa Department of Electrical and Computer Engineering, 5=Surgical Planning Lab, Harvard + """ + + input_fields = [ + ( + "fixedVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--fixedVolume %s", + "help_string": "Input fixed image (the moving image will be transformed into this image space).", + "exists": "True", + }, + ), + ), + ( + "movingVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--movingVolume %s", + "help_string": "Input moving image (this image will be transformed into the fixed image space).", + "exists": "True", + }, + ), + ), + ( + "samplingPercentage", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--samplingPercentage %f", + "help_string": "Fraction of voxels of the fixed image that will be used for registration. The number has to be larger than zero and less or equal to one. Higher values increase the computation time but may give more accurate results. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation. The default is 0.002 (use approximately 0.2% of voxels, resulting in 100000 samples in a 512x512x192 volume) to provide a very fast registration in most cases. Typical values range from 0.01 (1%) for low detail images to 0.2 (20%) for high detail images.", + }, + ), + ), + ( + "splineGridSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--splineGridSize %s", + "help_string": "Number of BSpline grid subdivisions along each axis of the fixed image, centered on the image space. Values must be 3 or higher for the BSpline to be correctly computed.", + "sep": ",", + }, + ), + ), + ( + "linearTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--linearTransform %s", + "help_string": "(optional) Output estimated transform - in case the computed transform is not BSpline. NOTE: You must set at least one output object (transform and/or output volume).", + "hash_files": "False", + }, + ), + ), + ( + "bsplineTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--bsplineTransform %s", + "help_string": "(optional) Output estimated transform - in case the computed transform is BSpline. NOTE: You must set at least one output object (transform and/or output volume).", + "hash_files": "False", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "(optional) Output image: the moving image warped to the fixed image space. NOTE: You must set at least one output object (transform and/or output volume).", + "hash_files": "False", + }, + ), + ), + ( + "initialTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--initialTransform %s", + "help_string": "Transform to be applied to the moving image to initialize the registration. This can only be used if Initialize Transform Mode is Off.", + "exists": "True", + }, + ), + ), + ( + "initializeTransformMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--initializeTransformMode %s", + "help_string": "Determine how to initialize the transform center. useMomentsAlign assumes that the center of mass of the images represent similar structures. useCenterOfHeadAlign attempts to use the top of head and shape of neck to drive a center of mass estimate. useGeometryAlign on assumes that the center of the voxel lattice of the images represent similar structures. Off assumes that the physical space of the images are close. This flag is mutually exclusive with the Initialization transform.", + }, + ), + ), + ( + "useRigid", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useRigid ", + "help_string": "Perform a rigid registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "useScaleVersor3D", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useScaleVersor3D ", + "help_string": "Perform a ScaleVersor3D registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "useScaleSkewVersor3D", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useScaleSkewVersor3D ", + "help_string": "Perform a ScaleSkewVersor3D registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "useAffine", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useAffine ", + "help_string": "Perform an Affine registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "useBSpline", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useBSpline ", + "help_string": "Perform a BSpline registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "useSyN", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useSyN ", + "help_string": "Perform a SyN registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "useComposite", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useComposite ", + "help_string": "Perform a Composite registration as part of the sequential registration steps. This family of options overrides the use of transformType if any of them are set.", + }, + ), + ), + ( + "maskProcessingMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--maskProcessingMode %s", + "help_string": "Specifies a mask to only consider a certain image region for the registration. If ROIAUTO is chosen, then the mask is computed using Otsu thresholding and hole filling. If ROI is chosen then the mask has to be specified as in input.", + }, + ), + ), + ( + "fixedBinaryVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--fixedBinaryVolume %s", + "help_string": "Fixed Image binary mask volume, required if Masking Option is ROI. Image areas where the mask volume has zero value are ignored during the registration.", + "exists": "True", + }, + ), + ), + ( + "movingBinaryVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--movingBinaryVolume %s", + "help_string": "Moving Image binary mask volume, required if Masking Option is ROI. Image areas where the mask volume has zero value are ignored during the registration.", + "exists": "True", + }, + ), + ), + ( + "outputFixedVolumeROI", + attr.ib( + type=File, + metadata={ + "argstr": "--outputFixedVolumeROI %s", + "help_string": "ROI that is automatically computed from the fixed image. Only available if Masking Option is ROIAUTO. Image areas where the mask volume has zero value are ignored during the registration.", + "hash_files": "False", + }, + ), + ), + ( + "outputMovingVolumeROI", + attr.ib( + type=File, + metadata={ + "argstr": "--outputMovingVolumeROI %s", + "help_string": "ROI that is automatically computed from the moving image. Only available if Masking Option is ROIAUTO. Image areas where the mask volume has zero value are ignored during the registration.", + "hash_files": "False", + }, + ), + ), + ( + "useROIBSpline", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useROIBSpline ", + "help_string": "If enabled then the bounding box of the input ROIs defines the BSpline grid support region. Otherwise the BSpline grid support region is the whole fixed image.", + }, + ), + ), + ( + "histogramMatch", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--histogramMatch ", + "help_string": "Apply histogram matching operation for the input images to make them more similar. This is suitable for images of the same modality that may have different brightness or contrast, but the same overall intensity profile. Do NOT use if registering images from different modalities.", + }, + ), + ), + ( + "medianFilterSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--medianFilterSize %s", + "help_string": "Apply median filtering to reduce noise in the input volumes. The 3 values specify the radius for the optional MedianImageFilter preprocessing in all 3 directions (in voxels).", + "sep": ",", + }, + ), + ), + ( + "removeIntensityOutliers", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--removeIntensityOutliers %f", + "help_string": "Remove very high and very low intensity voxels from the input volumes. The parameter specifies the half percentage to decide outliers of image intensities. The default value is zero, which means no outlier removal. If the value of 0.005 is given, the 0.005% of both tails will be thrown away, so 0.01% of intensities in total would be ignored in the statistic calculation.", + }, + ), + ), + ( + "fixedVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "--fixedVolume2 %s", + "help_string": "Input fixed image that will be used for multimodal registration. (the moving image will be transformed into this image space).", + "exists": "True", + }, + ), + ), + ( + "movingVolume2", + attr.ib( + type=File, + metadata={ + "argstr": "--movingVolume2 %s", + "help_string": "Input moving image that will be used for multimodal registration(this image will be transformed into the fixed image space).", + "exists": "True", + }, + ), + ), + ( + "outputVolumePixelType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--outputVolumePixelType %s", + "help_string": "Data type for representing a voxel of the Output Volume.", + }, + ), + ), + ( + "backgroundFillValue", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--backgroundFillValue %f", + "help_string": "This value will be used for filling those areas of the output image that have no corresponding voxels in the input moving image.", + }, + ), + ), + ( + "scaleOutputValues", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--scaleOutputValues ", + "help_string": "If true, and the voxel values do not fit within the minimum and maximum values of the desired outputVolumePixelType, then linearly scale the min/max output image voxel values to fit within the min/max range of the outputVolumePixelType.", + }, + ), + ), + ( + "interpolationMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolationMode %s", + "help_string": "Type of interpolation to be used when applying transform to moving volume. Options are Linear, NearestNeighbor, BSpline, WindowedSinc, Hamming, Cosine, Welch, Lanczos, or ResampleInPlace. The ResampleInPlace option will create an image with the same discrete voxel values and will adjust the origin and direction of the physical space interpretation.", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--numberOfIterations %s", + "help_string": "The maximum number of iterations to try before stopping the optimization. When using a lower value (500-1000) then the registration is forced to terminate earlier but there is a higher risk of stopping before an optimal solution is reached.", + "sep": ",", + }, + ), + ), + ( + "maximumStepLength", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maximumStepLength %f", + "help_string": "Starting step length of the optimizer. In general, higher values allow for recovering larger initial misalignments but there is an increased chance that the registration will not converge.", + }, + ), + ), + ( + "minimumStepLength", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--minimumStepLength %s", + "help_string": "Each step in the optimization takes steps at least this big. When none are possible, registration is complete. Smaller values allows the optimizer to make smaller adjustments, but the registration time may increase.", + "sep": ",", + }, + ), + ), + ( + "relaxationFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--relaxationFactor %f", + "help_string": "Specifies how quickly the optimization step length is decreased during registration. The value must be larger than 0 and smaller than 1. Larger values result in slower step size decrease, which allow for recovering larger initial misalignments but it increases the registration time and the chance that the registration will not converge.", + }, + ), + ), + ( + "translationScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--translationScale %f", + "help_string": "How much to scale up changes in position (in mm) compared to unit rotational changes (in radians) -- decrease this to allow for more rotation in the search pattern.", + }, + ), + ), + ( + "reproportionScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--reproportionScale %f", + "help_string": "ScaleVersor3D 'Scale' compensation factor. Increase this to allow for more rescaling in a ScaleVersor3D or ScaleSkewVersor3D search pattern. 1.0 works well with a translationScale of 1000.0", + }, + ), + ), + ( + "skewScale", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--skewScale %f", + "help_string": "ScaleSkewVersor3D Skew compensation factor. Increase this to allow for more skew in a ScaleSkewVersor3D search pattern. 1.0 works well with a translationScale of 1000.0", + }, + ), + ), + ( + "maxBSplineDisplacement", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maxBSplineDisplacement %f", + "help_string": "Maximum allowed displacements in image physical coordinates (mm) for BSpline control grid along each axis. A value of 0.0 indicates that the problem should be unbounded. NOTE: This only constrains the BSpline portion, and does not limit the displacement from the associated bulk transform. This can lead to a substantial reduction in computation time in the BSpline optimizer., ", + }, + ), + ), + ( + "fixedVolumeTimeIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--fixedVolumeTimeIndex %d", + "help_string": "The index in the time series for the 3D fixed image to fit. Only allowed if the fixed input volume is 4-dimensional.", + }, + ), + ), + ( + "movingVolumeTimeIndex", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--movingVolumeTimeIndex %d", + "help_string": "The index in the time series for the 3D moving image to fit. Only allowed if the moving input volume is 4-dimensional", + }, + ), + ), + ( + "numberOfHistogramBins", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfHistogramBins %d", + "help_string": "The number of histogram levels used for mutual information metric estimation.", + }, + ), + ), + ( + "numberOfMatchPoints", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfMatchPoints %d", + "help_string": "Number of histogram match points used for mutual information metric estimation.", + }, + ), + ), + ( + "costMetric", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--costMetric %s", + "help_string": "The cost metric to be used during fitting. Defaults to MMI. Options are MMI (Mattes Mutual Information), MSE (Mean Square Error), NC (Normalized Correlation), MC (Match Cardinality for binary images)", + }, + ), + ), + ( + "maskInferiorCutOffFromCenter", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maskInferiorCutOffFromCenter %f", + "help_string": "If Initialize Transform Mode is set to useCenterOfHeadAlign or Masking Option is ROIAUTO then this value defines the how much is cut of from the inferior part of the image. The cut-off distance is specified in millimeters, relative to the image center. If the value is 1000 or larger then no cut-off performed.", + }, + ), + ), + ( + "ROIAutoDilateSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--ROIAutoDilateSize %f", + "help_string": "This flag is only relevant when using ROIAUTO mode for initializing masks. It defines the final dilation size to capture a bit of background outside the tissue region. A setting of 10mm has been shown to help regularize a BSpline registration type so that there is some background constraints to match the edges of the head better.", + }, + ), + ), + ( + "ROIAutoClosingSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--ROIAutoClosingSize %f", + "help_string": "This flag is only relevant when using ROIAUTO mode for initializing masks. It defines the hole closing size in mm. It is rounded up to the nearest whole pixel size in each direction. The default is to use a closing size of 9mm. For mouse data this value may need to be reset to 0.9 or smaller.", + }, + ), + ), + ( + "numberOfSamples", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfSamples %d", + "help_string": "The number of voxels sampled for mutual information computation. Increase this for higher accuracy, at the cost of longer computation time.\nNOTE that it is suggested to use samplingPercentage instead of this option. However, if set to non-zero, numberOfSamples overwrites the samplingPercentage option. ", + }, + ), + ), + ( + "strippedOutputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--strippedOutputTransform %s", + "help_string": "Rigid component of the estimated affine transform. Can be used to rigidly register the moving image to the fixed image. NOTE: This value is overridden if either bsplineTransform or linearTransform is set.", + "hash_files": "False", + }, + ), + ), + ( + "transformType", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--transformType %s", + "help_string": "Specifies a list of registration types to be used. The valid types are, Rigid, ScaleVersor3D, ScaleSkewVersor3D, Affine, BSpline and SyN. Specifying more than one in a comma separated list will initialize the next stage with the previous results. If registrationClass flag is used, it overrides this parameter setting.", + "sep": ",", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransform %s", + "help_string": "(optional) Filename to which save the (optional) estimated transform. NOTE: You must select either the outputTransform or the outputVolume option.", + "hash_files": "False", + }, + ), + ), + ( + "initializeRegistrationByCurrentGenericTransform", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--initializeRegistrationByCurrentGenericTransform ", + "help_string": "If this flag is ON, the current generic composite transform, resulted from the linear registration stages, is set to initialize the follow nonlinear registration process. However, by the default behaviour, the moving image is first warped based on the existant transform before it is passed to the BSpline registration filter. It is done to speed up the BSpline registration by reducing the computations of composite transform Jacobian.", + }, + ), + ), + ( + "writeOutputTransformInFloat", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeOutputTransformInFloat ", + "help_string": "By default, the output registration transforms (either the output composite transform or each transform component) are written to the disk in double precision. If this flag is ON, the output transforms will be written in single (float) precision. It is especially important if the output transform is a displacement field transform, or it is a composite transform that includes several displacement fields.", + }, + ), + ), + ( + "failureExitCode", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--failureExitCode %d", + "help_string": "If the fit fails, exit with this status code. (It can be used to force a successfult exit status of (0) if the registration fails due to reaching the maximum number of iterations.", + }, + ), + ), + ( + "writeTransformOnFailure", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeTransformOnFailure ", + "help_string": "Flag to save the final transform even if the numberOfIterations are reached without convergence. (Intended for use when --failureExitCode 0 )", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use. (default is auto-detected)", + }, + ), + ), + ( + "debugLevel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--debugLevel %d", + "help_string": "Display debug messages, and produce debug intermediate results. 0=OFF, 1=Minimal, 10=Maximum debugging.", + }, + ), + ), + ( + "costFunctionConvergenceFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--costFunctionConvergenceFactor %f", + "help_string": "From itkLBFGSBOptimizer.h: Set/Get the CostFunctionConvergenceFactor. Algorithm terminates when the reduction in cost function is less than (factor * epsmcj) where epsmch is the machine precision. Typical values for factor: 1e+12 for low accuracy; 1e+7 for moderate accuracy and 1e+1 for extremely high accuracy. 1e+9 seems to work well., ", + }, + ), + ), + ( + "projectedGradientTolerance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--projectedGradientTolerance %f", + "help_string": "From itkLBFGSBOptimizer.h: Set/Get the ProjectedGradientTolerance. Algorithm terminates when the project gradient is below the tolerance. Default lbfgsb value is 1e-5, but 1e-4 seems to work well., ", + }, + ), + ), + ( + "maximumNumberOfEvaluations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maximumNumberOfEvaluations %d", + "help_string": "Maximum number of evaluations for line search in lbfgsb optimizer.", + }, + ), + ), + ( + "maximumNumberOfCorrections", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maximumNumberOfCorrections %d", + "help_string": "Maximum number of corrections in lbfgsb optimizer.", + }, + ), + ), + ( + "gui", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--gui ", + "help_string": "Display intermediate image volumes for debugging. NOTE: This is not part of the standard build sytem, and probably does nothing on your installation.", + }, + ), + ), + ( + "promptUser", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--promptUser ", + "help_string": "Prompt the user to hit enter each time an image is sent to the DebugImageViewer", + }, + ), + ), + ( + "metricSamplingStrategy", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--metricSamplingStrategy %s", + "help_string": "It defines the method that registration filter uses to sample the input fixed image. Only Random is supported for now.", + }, + ), + ), + ( + "logFileReport", + attr.ib( + type=File, + metadata={ + "argstr": "--logFileReport %s", + "help_string": "A file to write out final information report in CSV file: MetricName,MetricValue,FixedImageName,FixedMaskName,MovingImageName,MovingMaskName", + "hash_files": "False", + }, + ), + ), + ( + "printVersionInfo", + attr.ib(type=traits.Bool, metadata={"argstr": "--printVersionInfo "}), + ), + ] + output_fields = [ + ( + "linearTransform", + attr.ib( + type=File, + metadata={ + "help_string": "(optional) Output estimated transform - in case the computed transform is not BSpline. NOTE: You must set at least one output object (transform and/or output volume).", + "exists": "True", + }, + ), + ), + ( + "bsplineTransform", + attr.ib( + type=File, + metadata={ + "help_string": "(optional) Output estimated transform - in case the computed transform is BSpline. NOTE: You must set at least one output object (transform and/or output volume).", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "(optional) Output image: the moving image warped to the fixed image space. NOTE: You must set at least one output object (transform and/or output volume).", + "exists": "True", + }, + ), + ), + ( + "outputFixedVolumeROI", + attr.ib( + type=File, + metadata={ + "help_string": "ROI that is automatically computed from the fixed image. Only available if Masking Option is ROIAUTO. Image areas where the mask volume has zero value are ignored during the registration.", + "exists": "True", + }, + ), + ), + ( + "outputMovingVolumeROI", + attr.ib( + type=File, + metadata={ + "help_string": "ROI that is automatically computed from the moving image. Only available if Masking Option is ROIAUTO. Image areas where the mask volume has zero value are ignored during the registration.", + "exists": "True", + }, + ), + ), + ( + "strippedOutputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Rigid component of the estimated affine transform. Can be used to rigidly register the moving image to the fixed image. NOTE: This value is overridden if either bsplineTransform or linearTransform is set.", + "exists": "True", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "(optional) Filename to which save the (optional) estimated transform. NOTE: You must select either the outputTransform or the outputVolume option.", + "exists": "True", + }, + ), + ), + ( + "logFileReport", + attr.ib( + type=File, + metadata={ + "help_string": "A file to write out final information report in CSV file: MetricName,MetricValue,FixedImageName,FixedMaskName,MovingImageName,MovingMaskName", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSFit", + executable=" BRAINSFit ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/registration/brainsresample.py b/pydra/tasks/sem/registration/brainsresample.py new file mode 100644 index 0000000..e59d009 --- /dev/null +++ b/pydra/tasks/sem/registration/brainsresample.py @@ -0,0 +1,166 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSResample: + """ + title: Resample Image (BRAINS) + category: Registration + description: This program collects together three common image processing tasks that all involve resampling an image volume: Resampling to a new resolution and spacing, applying a transformation (using an ITK transform IO mechanisms) and Warping (using a vector image deformation field). Full documentation available here: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSResample. + version: 5.2.0 + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BRAINSResample + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: This tool was developed by Vincent Magnotta, Greg Harris, and Hans Johnson. + acknowledgements: The development of this tool was supported by funding from grants NS050568 and NS40068 from the National Institute of Neurological Disorders and Stroke and grants MH31593, MH40856, from the National Institute of Mental Health. + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Image To Warp", + "exists": "True", + }, + ), + ), + ( + "referenceVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--referenceVolume %s", + "help_string": "Reference image used only to define the output space. If not specified, the warping is done in the same space as the image to warp.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Resulting deformed image", + "hash_files": "False", + }, + ), + ), + ( + "pixelType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--pixelType %s", + "help_string": "Specifies the pixel type for the input/output images. The 'binary' pixel type uses a modified algorithm whereby the image is read in as unsigned char, a signed distance map is created, signed distance map is resampled, and then a thresholded image of type unsigned char is written to disk.", + }, + ), + ), + ( + "deformationVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--deformationVolume %s", + "help_string": "Displacement Field to be used to warp the image (ITKv3 or earlier)", + "exists": "True", + }, + ), + ), + ( + "warpTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--warpTransform %s", + "help_string": "Filename for the BRAINSFit transform (ITKv3 or earlier) or composite transform file (ITKv4)", + "exists": "True", + }, + ), + ), + ( + "interpolationMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolationMode %s", + "help_string": "Type of interpolation to be used when applying transform to moving volume. Options are Linear, ResampleInPlace, NearestNeighbor, BSpline, or WindowedSinc", + }, + ), + ), + ( + "inverseTransform", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--inverseTransform ", + "help_string": "True/False is to compute inverse of given transformation. Default is false", + }, + ), + ), + ( + "defaultValue", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--defaultValue %f", + "help_string": "Default voxel value", + }, + ), + ), + ( + "gridSpacing", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--gridSpacing %s", + "help_string": "Add warped grid to output image to help show the deformation that occured with specified spacing. A spacing of 0 in a dimension indicates that grid lines should be rendered to fall exactly (i.e. do not allow displacements off that plane). This is useful for makeing a 2D image of grid lines from the 3D space", + "sep": ",", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={"help_string": "Resulting deformed image", "exists": "True"}, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSResample", + executable=" BRAINSResample ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/registration/brainsresize.py b/pydra/tasks/sem/registration/brainsresize.py new file mode 100644 index 0000000..9011c6e --- /dev/null +++ b/pydra/tasks/sem/registration/brainsresize.py @@ -0,0 +1,91 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSResize: + """ + title: Resize Image (BRAINS) + category: Registration + description: This program is useful for downsampling an image by a constant scale factor. + version: 5.2.0 + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: This tool was developed by Hans Johnson. + acknowledgements: The development of this tool was supported by funding from grants NS050568 and NS40068 from the National Institute of Neurological Disorders and Stroke and grants MH31593, MH40856, from the National Institute of Mental Health. + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Image To Scale", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Resulting scaled image", + "hash_files": "False", + }, + ), + ), + ( + "pixelType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--pixelType %s", + "help_string": "Specifies the pixel type for the input/output images. The 'binary' pixel type uses a modified algorithm whereby the image is read in as unsigned char, a signed distance map is created, signed distance map is resampled, and then a thresholded image of type unsigned char is written to disk.", + }, + ), + ), + ( + "scaleFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--scaleFactor %f", + "help_string": "The scale factor for the image spacing.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={"help_string": "Resulting scaled image", "exists": "True"}, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSResize", + executable=" BRAINSResize ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/registration/performmetrictest.py b/pydra/tasks/sem/registration/performmetrictest.py new file mode 100644 index 0000000..1ee0510 --- /dev/null +++ b/pydra/tasks/sem/registration/performmetrictest.py @@ -0,0 +1,95 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class PerformMetricTest: + """ + title: Metric Test + category: Registration + description: Compare Mattes/MSQ metric value for two input images and a possible input BSpline transform. + version: 5.2.0 + documentation-url: A utility to compare metric value between two input images. + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Ali Ghayoor + """ + + input_fields = [ + ( + "inputBSplineTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--inputBSplineTransform %s", + "help_string": ", Input transform that is use to warp moving image before metric comparison., ", + "exists": "True", + }, + ), + ), + ( + "inputFixedImage", + attr.ib( + type=File, metadata={"argstr": "--inputFixedImage %s", "exists": "True"} + ), + ), + ( + "inputMovingImage", + attr.ib( + type=File, + metadata={"argstr": "--inputMovingImage %s", "exists": "True"}, + ), + ), + ( + "metricType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--metricType %s", + "help_string": "Comparison metric type", + }, + ), + ), + ( + "numberOfSamples", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfSamples %d", + "help_string": "The number of voxels sampled for metric evaluation.", + }, + ), + ), + ( + "numberOfHistogramBins", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfHistogramBins %d", + "help_string": "The number of historgram bins when MMI (Mattes) is metric type.", + }, + ), + ), + ] + output_fields = [] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="PerformMetricTest", + executable=" PerformMetricTest ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/registration/specialized.py b/pydra/tasks/sem/registration/specialized.py new file mode 100644 index 0000000..1953d6f --- /dev/null +++ b/pydra/tasks/sem/registration/specialized.py @@ -0,0 +1,289 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class ACPCTransform: + """ + title: ACPC Transform + category: Registration.Specialized + description:Calculate a transformation that aligns brain images to standard orientation based on anatomical landmarks.
The ACPC line extends between two points, one at the anterior commissure and one at the posterior commissure. The resulting transform will bring the line connecting the two points horizontal to the AP axis.
The midline is a series of points (at least 3) defining the division between the hemispheres of the brain (the mid sagittal plane). The resulting transform will result in the output volume having the mid sagittal plane lined up with the AS plane.
Use the Filtering module Resample Scalar/Vector/DWI Volume to apply the transformation to a volume.
+ version: 1.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/ACPCTransform + license: slicer3 + contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "acpc", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--acpc %s...", + "help_string": "ACPC line, a list of two fiducial points, one at the anterior commissure and one at the posterior commissure.", + }, + ), + ), + ( + "midline", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--midline %s...", + "help_string": "The midline is a series of points (at least 3) defining the division between the hemispheres of the brain (the mid sagittal plane).", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransform %s", + "help_string": "A transform filled in from the ACPC and Midline registration calculation.", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "A transform filled in from the ACPC and Midline registration calculation.", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ACPCTransform", + executable=" ACPCTransform ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSTransformFromFiducials: + """ + title: Fiducial Registration (BRAINS) + category: Registration.Specialized + description: Computes a rigid, similarity or affine transform from a matched list of fiducials + version: 5.2.0 + documentation-url: http://www.slicer.org/slicerWiki/index.php/Modules:TransformFromFiducials-Documentation-3.6 + contributor: Casey B Goodlett + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "fixedLandmarks", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--fixedLandmarks %s...", + "help_string": "Ordered list of landmarks in the fixed image", + }, + ), + ), + ( + "movingLandmarks", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--movingLandmarks %s...", + "help_string": "Ordered list of landmarks in the moving image", + }, + ), + ), + ( + "saveTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--saveTransform %s", + "help_string": "Save the transform that results from registration", + "hash_files": "False", + }, + ), + ), + ( + "transformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transformType %s", + "help_string": "Type of transform to produce", + }, + ), + ), + ( + "fixedLandmarksFile", + attr.ib( + type=File, + metadata={ + "argstr": "--fixedLandmarksFile %s", + "help_string": "An fcsv formatted file with a list of landmark points.", + "exists": "True", + }, + ), + ), + ( + "movingLandmarksFile", + attr.ib( + type=File, + metadata={ + "argstr": "--movingLandmarksFile %s", + "help_string": "An fcsv formatted file with a list of landmark points.", + "exists": "True", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "saveTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Save the transform that results from registration", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSTransformFromFiducials", + executable=" BRAINSTransformFromFiducials ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class FiducialRegistration: + """ + title: Fiducial Registration + category: Registration.Specialized + description: Computes a rigid, similarity or affine transform from a matched list of fiducials + version: 0.1.0.$Revision$ + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/TransformFromFiducials + contributor: Casey B Goodlett (Kitware), Dominik Meier (SPL, BWH) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "fixedLandmarks", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--fixedLandmarks %s...", + "help_string": "Ordered list of landmarks in the fixed image", + }, + ), + ), + ( + "movingLandmarks", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--movingLandmarks %s...", + "help_string": "Ordered list of landmarks in the moving image", + }, + ), + ), + ( + "saveTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--saveTransform %s", + "help_string": "Save the transform that results from registration", + "hash_files": "False", + }, + ), + ), + ( + "transformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--transformType %s", + "help_string": "Type of transform to produce", + }, + ), + ), + ( + "rms", + attr.ib( + type=traits.Float, + metadata={"argstr": "--rms %f", "help_string": "Display RMS Error."}, + ), + ), + ( + "outputMessage", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--outputMessage %s", + "help_string": "Provides more information on the output", + }, + ), + ), + ] + output_fields = [ + ( + "saveTransform", + attr.ib( + type=File, + metadata={ + "help_string": "Save the transform that results from registration", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="FiducialRegistration", + executable=" FiducialRegistration ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/segmentation/__init__.py b/pydra/tasks/sem/segmentation/__init__.py new file mode 100644 index 0000000..b8eb0eb --- /dev/null +++ b/pydra/tasks/sem/segmentation/__init__.py @@ -0,0 +1,13 @@ +from specialized import ( + BRAINSABC, + BRAINSCleanMask, + BRAINSConstellationDetector, + BRAINSCreateLabelMapFromProbabilityMaps, + BRAINSMultiSTAPLE, + BRAINSROIAuto, + BinaryMaskEditorBasedOnLandmarks, + ESLR, + RobustStatisticsSegmenter, + simpleEM, +) +from simpleregiongrowingsegmentation import SimpleRegionGrowingSegmentation diff --git a/pydra/tasks/sem/segmentation/simpleregiongrowingsegmentation.py b/pydra/tasks/sem/segmentation/simpleregiongrowingsegmentation.py new file mode 100644 index 0000000..1a2c5d0 --- /dev/null +++ b/pydra/tasks/sem/segmentation/simpleregiongrowingsegmentation.py @@ -0,0 +1,147 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class SimpleRegionGrowingSegmentation: + """ + title: Simple Region Growing Segmentation + category: Segmentation + description: A simple region growing segmentation algorithm based on intensity statistics. To create a list of fiducials (Seeds) for this algorithm, click on the tool bar icon of an arrow pointing to a sphere fiducial to enter the 'place a new object mode' and then use the Markups module. This module uses the Slicer Command Line Interface (CLI) and the ITK filters CurvatureFlowImageFilter and ConfidenceConnectedImageFilter. + version: 0.1.0.$Revision$(alpha) + documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/SimpleRegionGrowingSegmentation + contributor: Jim Miller (GE) + acknowledgements: This command module was derived from Insight/Examples (copyright) Insight Software Consortium + """ + + input_fields = [ + ( + "smoothingIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--smoothingIterations %d", + "help_string": "Number of smoothing iterations", + }, + ), + ), + ( + "timestep", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--timestep %f", + "help_string": "Timestep for curvature flow", + }, + ), + ), + ( + "iterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--iterations %d", + "help_string": "Number of iterations of region growing", + }, + ), + ), + ( + "multiplier", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--multiplier %f", + "help_string": "Number of standard deviations to include in intensity model", + }, + ), + ), + ( + "neighborhood", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--neighborhood %d", + "help_string": "The radius of the neighborhood over which to calculate intensity model", + }, + ), + ), + ( + "labelvalue", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--labelvalue %d", + "help_string": "The integer value (0-255) to use for the segmentation results. This will determine the color of the segmentation that will be generated by the Region growing algorithm", + }, + ), + ), + ( + "seed", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--seed %s...", + "help_string": "Seed point(s) for region growing", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input volume to be filtered", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output filtered", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output filtered", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="SimpleRegionGrowingSegmentation", + executable=" SimpleRegionGrowingSegmentation ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/segmentation/specialized.py b/pydra/tasks/sem/segmentation/specialized.py new file mode 100644 index 0000000..4bcc2ba --- /dev/null +++ b/pydra/tasks/sem/segmentation/specialized.py @@ -0,0 +1,1941 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class BRAINSABC: + """ + title: Intra-subject registration, bias Correction, and tissue classification (BRAINS) + category: Segmentation.Specialized + description: Atlas-based tissue segmentation method. This is an algorithmic extension of work done by XXXX at UNC and Utah XXXX need more description here. + """ + + input_fields = [ + ( + "inputVolumes", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputVolumes %s...", + "help_string": "The list of input image files to be segmented.", + }, + ), + ), + ( + "atlasDefinition", + attr.ib( + type=File, + metadata={ + "argstr": "--atlasDefinition %s", + "help_string": "Contains all parameters for Atlas", + "exists": "True", + }, + ), + ), + ( + "restoreState", + attr.ib( + type=File, + metadata={ + "argstr": "--restoreState %s", + "help_string": "The initial state for the registration process", + "exists": "True", + }, + ), + ), + ( + "saveState", + attr.ib( + type=File, + metadata={ + "argstr": "--saveState %s", + "help_string": "(optional) Filename to which save the final state of the registration", + "hash_files": "False", + }, + ), + ), + ( + "inputVolumeTypes", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputVolumeTypes %s", + "help_string": "The list of input image types corresponding to the inputVolumes.", + "sep": ",", + }, + ), + ), + ( + "outputDir", + attr.ib( + type=Directory, + metadata={ + "argstr": "--outputDir %s", + "help_string": "Ouput directory", + "hash_files": "False", + }, + ), + ), + ( + "atlasToSubjectTransformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--atlasToSubjectTransformType %s", + "help_string": " What type of linear transform type do you want to use to register the atlas to the reference subject image.", + }, + ), + ), + ( + "atlasToSubjectTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--atlasToSubjectTransform %s", + "help_string": "The transform from atlas to the subject", + "hash_files": "False", + }, + ), + ), + ( + "atlasToSubjectInitialTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--atlasToSubjectInitialTransform %s", + "help_string": "The initial transform from atlas to the subject", + "hash_files": "False", + }, + ), + ), + ( + "subjectIntermodeTransformType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--subjectIntermodeTransformType %s", + "help_string": " What type of transform type do you want to run intra subject registeration. Only Identity and Rigid are allowed.", + }, + ), + ), + ( + "outputVolumes", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--outputVolumes %s...", + "help_string": "Corrected Output Images: should specify the same number of images as inputVolume, if only one element is given, then it is used as a file pattern where %s is replaced by the imageVolumeType, and %d by the index list location.", + "hash_files": "False", + }, + ), + ), + ( + "outputLabels", + attr.ib( + type=File, + metadata={ + "argstr": "--outputLabels %s", + "help_string": "Output Label Image", + "hash_files": "False", + }, + ), + ), + ( + "outputDirtyLabels", + attr.ib( + type=File, + metadata={ + "argstr": "--outputDirtyLabels %s", + "help_string": "Output Dirty Label Image", + "hash_files": "False", + }, + ), + ), + ( + "posteriorTemplate", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--posteriorTemplate %s", + "help_string": "filename template for Posterior output files", + }, + ), + ), + ( + "outputFormat", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--outputFormat %s", + "help_string": "Output format", + }, + ), + ), + ( + "interpolationMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolationMode %s", + "help_string": "Type of interpolation to be used when applying transform to moving volume. Options are Linear, NearestNeighbor, BSpline, WindowedSinc, or ResampleInPlace. The ResampleInPlace option will create an image with the same discrete voxel values and will adjust the origin and direction of the physical space interpretation.", + }, + ), + ), + ( + "maxIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maxIterations %d", + "help_string": "Filter iterations", + }, + ), + ), + ( + "medianFilterSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--medianFilterSize %s", + "help_string": "The radius for the optional MedianImageFilter preprocessing in all 3 directions.", + "sep": ",", + }, + ), + ), + ( + "filterIteration", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--filterIteration %d", + "help_string": "Filter iterations", + }, + ), + ), + ( + "filterTimeStep", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--filterTimeStep %f", + "help_string": "Filter time step should be less than (PixelSpacing/(1^(DIM+1)), value is set to negative, then allow automatic setting of this value. ", + }, + ), + ), + ( + "filterMethod", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--filterMethod %s", + "help_string": "Filter method for preprocessing of registration", + }, + ), + ), + ( + "maxBiasDegree", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maxBiasDegree %d", + "help_string": "Maximum bias degree", + }, + ), + ), + ( + "useKNN", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--useKNN ", + "help_string": "Use the KNN stage of estimating posteriors.", + }, + ), + ), + ( + "purePlugsThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--purePlugsThreshold %f", + "help_string": "If this threshold value is greater than zero, only pure samples are used to compute the distributions in EM classification, and only pure samples are used for KNN training. The default value is set to 0, that means not using pure plugs. However, a value between 0 and 1 should be set as the threshold if you want to activate using pure plugs option. Empirically a value of 0.1 is suggested.", + }, + ), + ), + ( + "numberOfSubSamplesInEachPlugArea", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--numberOfSubSamplesInEachPlugArea %s", + "help_string": "Number of continous index samples taken at each direction of lattice space for each plug volume.", + "sep": ",", + }, + ), + ), + ( + "atlasWarpingOff", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--atlasWarpingOff ", + "help_string": "Deformable registration of atlas to subject", + }, + ), + ), + ( + "gridSize", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--gridSize %s", + "help_string": "Grid size for atlas warping with BSplines", + "sep": ",", + }, + ), + ), + ( + "defaultSuffix", + attr.ib(type=traits.Str, metadata={"argstr": "--defaultSuffix %s"}), + ), + ( + "implicitOutputs", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--implicitOutputs %s...", + "help_string": "Outputs to be made available to NiPype. Needed because not all BRAINSABC outputs have command line arguments.", + "hash_files": "False", + }, + ), + ), + ( + "debuglevel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--debuglevel %d", + "help_string": "Display debug messages, and produce debug intermediate results. 0=OFF, 1=Minimal, 10=Maximum debugging.", + }, + ), + ), + ( + "writeLess", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--writeLess ", + "help_string": "Does not write posteriors and filtered, bias corrected images", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "saveState", + attr.ib( + type=File, + metadata={ + "help_string": "(optional) Filename to which save the final state of the registration", + "exists": "True", + }, + ), + ), + ( + "outputDir", + attr.ib( + type=Directory, + metadata={"help_string": "Ouput directory", "exists": "True"}, + ), + ), + ( + "atlasToSubjectTransform", + attr.ib( + type=File, + metadata={ + "help_string": "The transform from atlas to the subject", + "exists": "True", + }, + ), + ), + ( + "atlasToSubjectInitialTransform", + attr.ib( + type=File, + metadata={ + "help_string": "The initial transform from atlas to the subject", + "exists": "True", + }, + ), + ), + ( + "outputVolumes", + attr.ib( + type=OutputMultiPath, + metadata={ + "help_string": "Corrected Output Images: should specify the same number of images as inputVolume, if only one element is given, then it is used as a file pattern where %s is replaced by the imageVolumeType, and %d by the index list location.", + "exists": "True", + }, + ), + ), + ( + "outputLabels", + attr.ib( + type=File, + metadata={"help_string": "Output Label Image", "exists": "True"}, + ), + ), + ( + "outputDirtyLabels", + attr.ib( + type=File, + metadata={"help_string": "Output Dirty Label Image", "exists": "True"}, + ), + ), + ( + "implicitOutputs", + attr.ib( + type=OutputMultiPath, + metadata={ + "help_string": "Outputs to be made available to NiPype. Needed because not all BRAINSABC outputs have command line arguments.", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSABC", + executable=" BRAINSABC ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSCleanMask: + """ + title: Mask Hole Filling (BRAINS) + category: Segmentation.Specialized + description: Cleans up a mask image by filling any holes + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "The mask image to be cleaned up.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "The cleaned mask image.", + "hash_files": "False", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={"help_string": "The cleaned mask image.", "exists": "True"}, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSCleanMask", + executable=" BRAINSCleanMask ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSConstellationDetector: + """ + title: Brain Landmark Constellation Detector (BRAINS) + category: Segmentation.Specialized + description: This program will find the mid-sagittal plane, a constellation of landmarks in a volume, and create an AC/PC aligned data set with the AC point at the center of the voxel lattice (labeled at the origin of the image physical space.) Part of this work is an extention of the algorithms originally described by Dr. Babak A. Ardekani, Alvin H. Bachman, Model-based automatic detection of the anterior and posterior commissures on MRI scans, NeuroImage, Volume 46, Issue 3, 1 July 2009, Pages 677-682, ISSN 1053-8119, DOI: 10.1016/j.neuroimage.2009.02.030. (http://www.sciencedirect.com/science/article/B6WNP-4VRP25C-4/2/8207b962a38aa83c822c6379bc43fe4c) + version: 5.2.0 + documentation-url: http://www.nitrc.org/projects/brainscdetector/ + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Hans J. Johnson (hans-johnson -at- uiowa.edu), Ali Ghayoor + acknowledgements: Hans Johnson(1,2,3); Ali Ghayoor(3); Wei Lu(3) 1=University of Iowa Department of Psychiatry, 2=University of Iowa Department of Biomedical Engineering, 3=University of Iowa Department of Electrical and Computer Engineering + """ + + input_fields = [ + ( + "houghEyeDetectorMode", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--houghEyeDetectorMode %d", + "help_string": ", This flag controls the mode of Hough eye detector. By default, value of 1 is for T1W images, while the value of 0 is for T2W and PD images., ", + }, + ), + ), + ( + "inputTemplateModel", + attr.ib( + type=File, + metadata={ + "argstr": "--inputTemplateModel %s", + "help_string": "User-specified template model., ", + "exists": "True", + }, + ), + ), + ( + "LLSModel", + attr.ib( + type=File, + metadata={ + "argstr": "--LLSModel %s", + "help_string": "Linear least squares model filename in HD5 format", + "exists": "True", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Input image in which to find ACPC points", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "ACPC-aligned output image with the same voxels as the input image, but updated origin, and direction cosign so that the AC point would fall at the physical location (0.0,0.0,0.0), and the mid-sagital plane is the plane where physical L/R coordinate is 0.0. No interpolation method is involved to create the 'outputVolume', and this output image is created using 'resample in place' filter.", + "hash_files": "False", + }, + ), + ), + ( + "outputResampledVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputResampledVolume %s", + "help_string": "ACPC-aligned output image in a resampled uniform isotropic space. Currently this is a 1mm, 256^3 image with identity direction cosign. Choose desired interpolation mode to generate the outputResampledVolume.", + "hash_files": "False", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "argstr": "--outputTransform %s", + "help_string": "The filename for the original space to ACPC alignment to be written (in .h5 format)., ", + "hash_files": "False", + }, + ), + ), + ( + "outputLandmarksInInputSpace", + attr.ib( + type=File, + metadata={ + "argstr": "--outputLandmarksInInputSpace %s", + "help_string": ", The filename for the new subject-specific landmark definition file in the same format produced by Slicer3 (.fcsv) with the landmarks in the original image space (the detected RP, AC, PC, and VN4) in it to be written., ", + "hash_files": "False", + }, + ), + ), + ( + "outputLandmarksInACPCAlignedSpace", + attr.ib( + type=File, + metadata={ + "argstr": "--outputLandmarksInACPCAlignedSpace %s", + "help_string": ", The filename for the new subject-specific landmark definition file in the same format produced by Slicer3 (.fcsv) with the landmarks in the output image space (the detected RP, AC, PC, and VN4) in it to be written., ", + "hash_files": "False", + }, + ), + ), + ( + "outputMRML", + attr.ib( + type=File, + metadata={ + "argstr": "--outputMRML %s", + "help_string": ", The filename for the new subject-specific scene definition file in the same format produced by Slicer3 (in .mrml format). Only the components that were specified by the user on command line would be generated. Compatible components include inputVolume, outputVolume, outputLandmarksInInputSpace, outputLandmarksInACPCAlignedSpace, and outputTransform., ", + "hash_files": "False", + }, + ), + ), + ( + "outputVerificationScript", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVerificationScript %s", + "help_string": ", The filename for the Slicer3 script that verifies the aligned landmarks against the aligned image file. This will happen only in conjunction with saveOutputLandmarks and an outputVolume., ", + "hash_files": "False", + }, + ), + ), + ( + "mspQualityLevel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--mspQualityLevel %d", + "help_string": ", Flag cotrols how agressive the MSP is estimated. 0=quick estimate (9 seconds), 1=normal estimate (11 seconds), 2=great estimate (22 seconds), 3=best estimate (58 seconds), NOTE: -1= Prealigned so no estimate!., ", + }, + ), + ), + ( + "otsuPercentileThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--otsuPercentileThreshold %f", + "help_string": ", This is a parameter to FindLargestForegroundFilledMask, which is employed when acLowerBound is set and an outputUntransformedClippedVolume is requested., ", + }, + ), + ), + ( + "acLowerBound", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--acLowerBound %f", + "help_string": ", When generating a resampled output image, replace the image with the BackgroundFillValue everywhere below the plane This Far in physical units (millimeters) below (inferior to) the AC point (as found by the model.) The oversize default was chosen to have no effect. Based on visualizing a thousand masks in the IPIG study, we recommend a limit no smaller than 80.0 mm., ", + }, + ), + ), + ( + "cutOutHeadInOutputVolume", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--cutOutHeadInOutputVolume ", + "help_string": ", Flag to cut out just the head tissue when producing an (un)transformed clipped volume., ", + }, + ), + ), + ( + "outputUntransformedClippedVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputUntransformedClippedVolume %s", + "help_string": "Output image in which to store neck-clipped input image, with the use of --acLowerBound and maybe --cutOutHeadInUntransformedVolume.", + "hash_files": "False", + }, + ), + ), + ( + "rescaleIntensities", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--rescaleIntensities ", + "help_string": ", Flag to turn on rescaling image intensities on input., ", + }, + ), + ), + ( + "trimRescaledIntensities", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--trimRescaledIntensities %f", + "help_string": ", Turn on clipping the rescaled image one-tailed on input. Units of standard deviations above the mean. Very large values are very permissive. Non-positive value turns clipping off. Defaults to removing 0.00001 of a normal tail above the mean., ", + }, + ), + ), + ( + "rescaleIntensitiesOutputRange", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--rescaleIntensitiesOutputRange %s", + "help_string": ", This pair of integers gives the lower and upper bounds on the signal portion of the output image. Out-of-field voxels are taken from BackgroundFillValue., ", + "sep": ",", + }, + ), + ), + ( + "BackgroundFillValue", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--BackgroundFillValue %s", + "help_string": "Fill the background of image with specified short int value. Enter number or use BIGNEG for a large negative number.", + }, + ), + ), + ( + "interpolationMode", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--interpolationMode %s", + "help_string": "Type of interpolation to be used when applying transform to moving volume to create OutputResampledVolume. Options are Linear, NearestNeighbor, BSpline, or WindowedSinc", + }, + ), + ), + ( + "forceACPoint", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--forceACPoint %s", + "help_string": ", Manually specify the AC point from the original image in RAS coordinates (i.e. Slicer coordinates)., ", + "sep": ",", + }, + ), + ), + ( + "forcePCPoint", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--forcePCPoint %s", + "help_string": ", Manually specify the PC point from the original image in RAS coordinates (i.e. Slicer coordinates)., ", + "sep": ",", + }, + ), + ), + ( + "forceVN4Point", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--forceVN4Point %s", + "help_string": ", Manually specify the VN4 point from the original image in RAS coordinates (i.e. Slicer coordinates)., ", + "sep": ",", + }, + ), + ), + ( + "forceRPPoint", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--forceRPPoint %s", + "help_string": ", Manually specify the RP point from the original image in RAS coordinates (i.e. Slicer coordinates)., ", + "sep": ",", + }, + ), + ), + ( + "inputLandmarksEMSP", + attr.ib( + type=File, + metadata={ + "argstr": "--inputLandmarksEMSP %s", + "help_string": ", The filename for the new subject-specific landmark definition file in the same format produced by Slicer3 (in .fcsv) with the landmarks in the estimated MSP aligned space to be loaded. The detector will only process landmarks not enlisted on the file., ", + "exists": "True", + }, + ), + ), + ( + "forceHoughEyeDetectorReportFailure", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--forceHoughEyeDetectorReportFailure ", + "help_string": ", Flag indicates whether the Hough eye detector should report failure, ", + }, + ), + ), + ( + "rmpj", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rmpj %f", + "help_string": ", Search radius for MPJ in unit of mm, ", + }, + ), + ), + ( + "rac", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rac %f", + "help_string": ", Search radius for AC in unit of mm, ", + }, + ), + ), + ( + "rpc", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rpc %f", + "help_string": ", Search radius for PC in unit of mm, ", + }, + ), + ), + ( + "rVN4", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--rVN4 %f", + "help_string": ", Search radius for VN4 in unit of mm, ", + }, + ), + ), + ( + "debug", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--debug ", + "help_string": ", Show internal debugging information., ", + }, + ), + ), + ( + "verbose", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--verbose ", + "help_string": ", Show more verbose output, ", + }, + ), + ), + ( + "writeBranded2DImage", + attr.ib( + type=File, + metadata={ + "argstr": "--writeBranded2DImage %s", + "help_string": ", The filename for the 2D .png branded midline debugging image. This will happen only in conjunction with requesting an outputVolume., ", + "hash_files": "False", + }, + ), + ), + ( + "resultsDir", + attr.ib( + type=Directory, + metadata={ + "argstr": "--resultsDir %s", + "help_string": ", The directory for the debuging images to be written., ", + "hash_files": "False", + }, + ), + ), + ( + "writedebuggingImagesLevel", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--writedebuggingImagesLevel %d", + "help_string": ", This flag controls if debugging images are produced. By default value of 0 is no images. Anything greater than zero will be increasing level of debugging images., ", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ( + "atlasVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--atlasVolume %s", + "help_string": "Atlas volume image to be used for BRAINSFit registration to redefine the final ACPC-aligned transform by registering original input image to the Atlas image. The initial registration transform is created by passing BCD_ACPC_Landmarks and atlasLandmarks to BRAINSLandmarkInitializer. This flag should be used with atlasLandmarks and atlasLandmarkWeights flags. Note that using this flag causes that AC point in the final acpcLandmark file not be exactly placed at 0,0,0 coordinates., ", + "exists": "True", + }, + ), + ), + ( + "atlasLandmarks", + attr.ib( + type=File, + metadata={ + "argstr": "--atlasLandmarks %s", + "help_string": "Atlas landmarks to be used for BRAINSFit registration initialization, ", + "exists": "True", + }, + ), + ), + ( + "atlasLandmarkWeights", + attr.ib( + type=File, + metadata={ + "argstr": "--atlasLandmarkWeights %s", + "help_string": "Weights associated with atlas landmarks to be used for BRAINSFit registration initialization, ", + "exists": "True", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "ACPC-aligned output image with the same voxels as the input image, but updated origin, and direction cosign so that the AC point would fall at the physical location (0.0,0.0,0.0), and the mid-sagital plane is the plane where physical L/R coordinate is 0.0. No interpolation method is involved to create the 'outputVolume', and this output image is created using 'resample in place' filter.", + "exists": "True", + }, + ), + ), + ( + "outputResampledVolume", + attr.ib( + type=File, + metadata={ + "help_string": "ACPC-aligned output image in a resampled uniform isotropic space. Currently this is a 1mm, 256^3 image with identity direction cosign. Choose desired interpolation mode to generate the outputResampledVolume.", + "exists": "True", + }, + ), + ), + ( + "outputTransform", + attr.ib( + type=File, + metadata={ + "help_string": "The filename for the original space to ACPC alignment to be written (in .h5 format)., ", + "exists": "True", + }, + ), + ), + ( + "outputLandmarksInInputSpace", + attr.ib( + type=File, + metadata={ + "help_string": ", The filename for the new subject-specific landmark definition file in the same format produced by Slicer3 (.fcsv) with the landmarks in the original image space (the detected RP, AC, PC, and VN4) in it to be written., ", + "exists": "True", + }, + ), + ), + ( + "outputLandmarksInACPCAlignedSpace", + attr.ib( + type=File, + metadata={ + "help_string": ", The filename for the new subject-specific landmark definition file in the same format produced by Slicer3 (.fcsv) with the landmarks in the output image space (the detected RP, AC, PC, and VN4) in it to be written., ", + "exists": "True", + }, + ), + ), + ( + "outputMRML", + attr.ib( + type=File, + metadata={ + "help_string": ", The filename for the new subject-specific scene definition file in the same format produced by Slicer3 (in .mrml format). Only the components that were specified by the user on command line would be generated. Compatible components include inputVolume, outputVolume, outputLandmarksInInputSpace, outputLandmarksInACPCAlignedSpace, and outputTransform., ", + "exists": "True", + }, + ), + ), + ( + "outputVerificationScript", + attr.ib( + type=File, + metadata={ + "help_string": ", The filename for the Slicer3 script that verifies the aligned landmarks against the aligned image file. This will happen only in conjunction with saveOutputLandmarks and an outputVolume., ", + "exists": "True", + }, + ), + ), + ( + "outputUntransformedClippedVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output image in which to store neck-clipped input image, with the use of --acLowerBound and maybe --cutOutHeadInUntransformedVolume.", + "exists": "True", + }, + ), + ), + ( + "writeBranded2DImage", + attr.ib( + type=File, + metadata={ + "help_string": ", The filename for the 2D .png branded midline debugging image. This will happen only in conjunction with requesting an outputVolume., ", + "exists": "True", + }, + ), + ), + ( + "resultsDir", + attr.ib( + type=Directory, + metadata={ + "help_string": ", The directory for the debuging images to be written., ", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSConstellationDetector", + executable=" BRAINSConstellationDetector ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSCreateLabelMapFromProbabilityMaps: + """ + title: Create Label Map From Probability Maps (BRAINS) + category: Segmentation.Specialized + description: Given A list of Probability Maps, generate a LabelMap. + """ + + input_fields = [ + ( + "inputProbabilityVolume", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputProbabilityVolume %s...", + "help_string": "The list of proobabilityimages.", + }, + ), + ), + ( + "priorLabelCodes", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--priorLabelCodes %s", + "help_string": "A list of PriorLabelCode values used for coding the output label images", + "sep": ",", + }, + ), + ), + ( + "foregroundPriors", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--foregroundPriors %s", + "help_string": "A list: For each Prior Label, 1 if foreground, 0 if background", + "sep": ",", + }, + ), + ), + ( + "nonAirRegionMask", + attr.ib( + type=File, + metadata={ + "argstr": "--nonAirRegionMask %s", + "help_string": "a mask representing the 'NonAirRegion' -- Just force pixels in this region to zero", + "exists": "True", + }, + ), + ), + ( + "inclusionThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--inclusionThreshold %f", + "help_string": "tolerance for inclusion", + }, + ), + ), + ( + "dirtyLabelVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--dirtyLabelVolume %s", + "help_string": "the labels prior to cleaning", + "hash_files": "False", + }, + ), + ), + ( + "cleanLabelVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--cleanLabelVolume %s", + "help_string": "the foreground labels volume", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "dirtyLabelVolume", + attr.ib( + type=File, + metadata={ + "help_string": "the labels prior to cleaning", + "exists": "True", + }, + ), + ), + ( + "cleanLabelVolume", + attr.ib( + type=File, + metadata={ + "help_string": "the foreground labels volume", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSCreateLabelMapFromProbabilityMaps", + executable=" BRAINSCreateLabelMapFromProbabilityMaps ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSMultiSTAPLE: + """ + title: Create best representative label map) + category: Segmentation.Specialized + description: given a list of label map images, create a representative/average label map. + """ + + input_fields = [ + ( + "inputCompositeT1Volume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputCompositeT1Volume %s", + "help_string": "Composite T1, all label maps transofrmed into the space for this image.", + "exists": "True", + }, + ), + ), + ( + "inputLabelVolume", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputLabelVolume %s...", + "help_string": "The list of proobabilityimages.", + }, + ), + ), + ( + "inputTransform", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputTransform %s...", + "help_string": "transforms to apply to label volumes", + }, + ), + ), + ( + "labelForUndecidedPixels", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--labelForUndecidedPixels %d", + "help_string": "Label for undecided pixels", + }, + ), + ), + ( + "resampledVolumePrefix", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--resampledVolumePrefix %s", + "help_string": "if given, write out resampled volumes with this prefix", + }, + ), + ), + ( + "skipResampling", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--skipResampling ", + "help_string": "Omit resampling images into reference space", + }, + ), + ), + ( + "outputMultiSTAPLE", + attr.ib( + type=File, + metadata={ + "argstr": "--outputMultiSTAPLE %s", + "help_string": "the MultiSTAPLE average of input label volumes", + "hash_files": "False", + }, + ), + ), + ( + "outputConfusionMatrix", + attr.ib( + type=File, + metadata={ + "argstr": "--outputConfusionMatrix %s", + "help_string": "Confusion Matrix", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputMultiSTAPLE", + attr.ib( + type=File, + metadata={ + "help_string": "the MultiSTAPLE average of input label volumes", + "exists": "True", + }, + ), + ), + ( + "outputConfusionMatrix", + attr.ib( + type=File, + metadata={"help_string": "Confusion Matrix", "exists": "True"}, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSMultiSTAPLE", + executable=" BRAINSMultiSTAPLE ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BRAINSROIAuto: + """ + title: Foreground masking (BRAINS) + category: Segmentation.Specialized + description: This program is used to create a mask over the most prominant forground region in an image. This is accomplished via a combination of otsu thresholding and a closing operation. More documentation is available here: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/ForegroundMasking. + version: 5.2.0 + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Hans J. Johnson, hans-johnson -at- uiowa.edu, http://www.psychiatry.uiowa.edu + acknowledgements: Hans Johnson(1,3,4); Kent Williams(1); Gregory Harris(1), Vincent Magnotta(1,2,3); Andriy Fedorov(5), fedorov -at- bwh.harvard.edu (Slicer integration); (1=University of Iowa Department of Psychiatry, 2=University of Iowa Department of Radiology, 3=University of Iowa Department of Biomedical Engineering, 4=University of Iowa Department of Electrical and Computer Engineering, 5=Surgical Planning Lab, Harvard) + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "The input image for finding the largest region filled mask.", + "exists": "True", + }, + ), + ), + ( + "outputROIMaskVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputROIMaskVolume %s", + "help_string": "The ROI automatically found from the input image.", + "hash_files": "False", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "The inputVolume with optional [maskOutput|cropOutput] to the region of the brain mask.", + "hash_files": "False", + }, + ), + ), + ( + "maskOutput", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--maskOutput ", + "help_string": "The inputVolume multiplied by the ROI mask.", + }, + ), + ), + ( + "cropOutput", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--cropOutput ", + "help_string": "The inputVolume cropped to the region of the ROI mask.", + }, + ), + ), + ( + "otsuPercentileThreshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--otsuPercentileThreshold %f", + "help_string": "Parameter to the Otsu threshold algorithm.", + }, + ), + ), + ( + "thresholdCorrectionFactor", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--thresholdCorrectionFactor %f", + "help_string": "A factor to scale the Otsu algorithm's result threshold, in case clipping mangles the image.", + }, + ), + ), + ( + "closingSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--closingSize %f", + "help_string": "The Closing Size (in millimeters) for largest connected filled mask. This value is divided by image spacing and rounded to the next largest voxel number.", + }, + ), + ), + ( + "ROIAutoDilateSize", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--ROIAutoDilateSize %f", + "help_string": "This flag is only relavent when using ROIAUTO mode for initializing masks. It defines the final dilation size to capture a bit of background outside the tissue region. At setting of 10mm has been shown to help regularize a BSpline registration type so that there is some background constraints to match the edges of the head better.", + }, + ), + ), + ( + "outputVolumePixelType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--outputVolumePixelType %s", + "help_string": "The output image Pixel Type is the scalar datatype for representation of the Output Volume.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputROIMaskVolume", + attr.ib( + type=File, + metadata={ + "help_string": "The ROI automatically found from the input image.", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "The inputVolume with optional [maskOutput|cropOutput] to the region of the brain mask.", + "exists": "True", + }, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BRAINSROIAuto", + executable=" BRAINSROIAuto ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class BinaryMaskEditorBasedOnLandmarks: + """ + title: BRAINS Binary Mask Editor Based On Landmarks(BRAINS) + category: Segmentation.Specialized + version: 5.2.0 + documentation-url: http://www.nitrc.org/projects/brainscdetector/ + """ + + input_fields = [ + ( + "inputBinaryVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputBinaryVolume %s", + "help_string": "Input binary image in which to be edited", + "exists": "True", + }, + ), + ), + ( + "outputBinaryVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputBinaryVolume %s", + "help_string": "Output binary image in which to be edited", + "hash_files": "False", + }, + ), + ), + ( + "inputLandmarksFilename", + attr.ib( + type=File, + metadata={ + "argstr": "--inputLandmarksFilename %s", + "help_string": " The filename for the landmark definition file in the same format produced by Slicer3 (.fcsv). ", + "exists": "True", + }, + ), + ), + ( + "inputLandmarkNames", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputLandmarkNames %s", + "help_string": " A target input landmark name to be edited. This should be listed in the inputLandmakrFilename Given. ", + "sep": ",", + }, + ), + ), + ( + "setCutDirectionForLandmark", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--setCutDirectionForLandmark %s", + "help_string": "Setting the cutting out direction of the input binary image to the one of anterior, posterior, left, right, superior or posterior. (ENUMERATION: ANTERIOR, POSTERIOR, LEFT, RIGHT, SUPERIOR, POSTERIOR) ", + "sep": ",", + }, + ), + ), + ( + "setCutDirectionForObliquePlane", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--setCutDirectionForObliquePlane %s", + "help_string": "If this is true, the mask will be thresholded out to the direction of inferior, posterior, and/or left. Default behavrior is that cutting out to the direction of superior, anterior and/or right. ", + "sep": ",", + }, + ), + ), + ( + "inputLandmarkNamesForObliquePlane", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputLandmarkNamesForObliquePlane %s", + "help_string": " Three subset landmark names of inputLandmarksFilename for a oblique plane computation. The plane computed for binary volume editing. ", + "sep": ",", + }, + ), + ), + ] + output_fields = [ + ( + "outputBinaryVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Output binary image in which to be edited", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="BinaryMaskEditorBasedOnLandmarks", + executable=" BinaryMaskEditorBasedOnLandmarks ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class ESLR: + """ + title: Clean Contiguous Label Map (BRAINS) + category: Segmentation.Specialized + description: From a range of label map values, extract the largest contiguous region of those labels + """ + + input_fields = [ + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--inputVolume %s", + "help_string": "Input Label Volume", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--outputVolume %s", + "help_string": "Output Label Volume", + "hash_files": "False", + }, + ), + ), + ( + "low", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--low %d", + "help_string": "The lower bound of the labels to be used.", + }, + ), + ), + ( + "high", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--high %d", + "help_string": "The higher bound of the labels to be used.", + }, + ), + ), + ( + "closingSize", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--closingSize %d", + "help_string": "The closing size for hole filling.", + }, + ), + ), + ( + "openingSize", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--openingSize %d", + "help_string": "The opening size for hole filling.", + }, + ), + ), + ( + "safetySize", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--safetySize %d", + "help_string": "The safetySize size for the clipping region.", + }, + ), + ), + ( + "preserveOutside", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--preserveOutside ", + "help_string": "For values outside the specified range, preserve those values.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={"help_string": "Output Label Volume", "exists": "True"}, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="ESLR", executable=" ESLR ", input_spec=input_spec, output_spec=output_spec + ) + + +class RobustStatisticsSegmenter: + """ + title: Robust Statistics Segmenter + category: Segmentation.Specialized + description: Active contour segmentation using robust statistic. + version: 1.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/RobustStatisticsSegmenter + contributor: Yi Gao (gatech), Allen Tannenbaum (gatech), Ron Kikinis (SPL, BWH) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health + """ + + input_fields = [ + ( + "expectedVolume", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--expectedVolume %f", + "help_string": "The approximate volume of the object, in mL.", + }, + ), + ), + ( + "intensityHomogeneity", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--intensityHomogeneity %f", + "help_string": "What is the homogeneity of intensity within the object? Given constant intensity at 1.0 score and extreme fluctuating intensity at 0.", + }, + ), + ), + ( + "curvatureWeight", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--curvatureWeight %f", + "help_string": "Given sphere 1.0 score and extreme rough bounday/surface 0 score, what is the expected smoothness of the object?", + }, + ), + ), + ( + "labelValue", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--labelValue %d", + "help_string": "Label value of the output image", + }, + ), + ), + ( + "maxRunningTime", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maxRunningTime %f", + "help_string": "The program will stop if this time is reached.", + }, + ), + ), + ( + "originalImageFileName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Original image to be segmented", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "labelImageFileName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Label image for initialization", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "segmentedImageFileName", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Segmented image", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "segmentedImageFileName", + attr.ib( + type=File, + metadata={ + "help_string": "Segmented image", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="RobustStatisticsSegmenter", + executable=" RobustStatisticsSegmenter ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class simpleEM: + """ + title: simpleEM (BRAINS) + category: Segmentation.Specialized + description: Atlas-based tissue segmentation method + """ + + input_fields = [ + ( + "t1Volume", + attr.ib( + type=File, + metadata={ + "argstr": "--t1Volume %s", + "help_string": "T1 Volume", + "exists": "True", + }, + ), + ), + ( + "t2Volume", + attr.ib( + type=File, + metadata={ + "argstr": "--t2Volume %s", + "help_string": "T2 Volume", + "exists": "True", + }, + ), + ), + ( + "pdVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--pdVolume %s", + "help_string": "PD Volume", + "exists": "True", + }, + ), + ), + ( + "templateVolume", + attr.ib( + type=File, + metadata={ + "argstr": "--templateVolume %s", + "help_string": "template Volume", + "exists": "True", + }, + ), + ), + ( + "priorsList", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--priorsList %s", + "help_string": " number of input should same to the number of priorsList", + "sep": ",", + }, + ), + ), + ( + "priorsWeightList", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--priorsWeightList %s", + "help_string": " number of input should same to the number of priorsList", + "sep": ",", + }, + ), + ), + ( + "likelihoodTolerance", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--likelihoodTolerance %f", + "help_string": " a convergence parameter (0 indicates take the default from the EMSegmentationFilter constructor.)", + }, + ), + ), + ("warp", attr.ib(type=traits.Bool, metadata={"argstr": "--warp "})), + ( + "degreeOfBiasFieldCorrection", + attr.ib( + type=traits.Int, metadata={"argstr": "--degreeOfBiasFieldCorrection %d"} + ), + ), + ( + "maxIteration", + attr.ib(type=traits.Int, metadata={"argstr": "--maxIteration %d"}), + ), + ( + "OutputFileNamePrefix", + attr.ib(type=traits.Str, metadata={"argstr": "--OutputFileNamePrefix %s"}), + ), + ( + "inputPixelType", + attr.ib( + type=traits.Enum, + metadata={"argstr": "--inputPixelType %s", "help_string": "Input Type"}, + ), + ), + ( + "outputPixelType", + attr.ib( + type=traits.Enum, + metadata={ + "argstr": "--outputPixelType %s", + "help_string": "Input Type", + }, + ), + ), + ( + "priorPixelType", + attr.ib( + type=traits.Enum, + metadata={"argstr": "--priorPixelType %s", "help_string": "prior Type"}, + ), + ), + ] + output_fields = [] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="simpleEM", + executable=" simpleEM ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/setup.py b/pydra/tasks/sem/setup.py new file mode 100644 index 0000000..d872620 --- /dev/null +++ b/pydra/tasks/sem/setup.py @@ -0,0 +1,20 @@ +def configuration(parent_package="", top_path=None): + from numpy.distutils.misc_util import Configuration + + config = Configuration("", parent_package, top_path) + + config.add_data_dir("registration") + config.add_data_dir("filtering") + config.add_data_dir("segmentation") + config.add_data_dir("utilities") + config.add_data_dir("diffusion") + config.add_data_dir("brains") + config.add_data_dir("legacy") + + return config + + +if __name__ == "__main__": + from numpy.distutils.core import setup + + setup(**configuration(top_path="").todict()) diff --git a/pydra/tasks/sem/superresolution.py b/pydra/tasks/sem/superresolution.py new file mode 100644 index 0000000..43b0626 --- /dev/null +++ b/pydra/tasks/sem/superresolution.py @@ -0,0 +1,151 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class GenerateEdgeMapImage: + """ + title: GenerateEdgeMapImage + category: SuperResolution + description: Inverse of Maximum Gradient Image + version: 5.2.0 + license: https://www.nitrc.org/svn/brains/BuildScripts/trunk/License.txt + contributor: Ali Ghayoor + """ + + input_fields = [ + ( + "inputMRVolumes", + attr.ib( + type=InputMultiPath, + metadata={ + "argstr": "--inputMRVolumes %s...", + "help_string": "Input image files names", + }, + ), + ), + ( + "inputMask", + attr.ib( + type=File, + metadata={ + "argstr": "--inputMask %s", + "help_string": "Input mask file name. If set, image histogram percentiles will be calculated within the mask", + "exists": "True", + }, + ), + ), + ( + "outputMaximumGradientImage", + attr.ib( + type=File, + metadata={ + "argstr": "--outputMaximumGradientImage %s", + "help_string": "output gradient image file name", + "hash_files": "False", + }, + ), + ), + ( + "outputEdgeMap", + attr.ib( + type=File, + metadata={ + "argstr": "--outputEdgeMap %s", + "help_string": "output edgemap file name", + "hash_files": "False", + }, + ), + ), + ( + "lowerPercentileMatching", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--lowerPercentileMatching %f", + "help_string": "Map lower quantile and below to minOutputRange. It should be a value between zero and one.", + }, + ), + ), + ( + "upperPercentileMatching", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--upperPercentileMatching %f", + "help_string": "Map upper quantile and above to maxOutputRange. It should be a value between zero and one.", + }, + ), + ), + ( + "minimumOutputRange", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--minimumOutputRange %d", + "help_string": "Map lower quantile and below to minimum output range. It should be an epsilon number greater than zero. Default is 1.", + }, + ), + ), + ( + "maximumOutputRange", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--maximumOutputRange %d", + "help_string": "Map upper quantile and above to maximum output range. Default is 255 that is the maximum range of unsigned char.", + }, + ), + ), + ( + "numberOfThreads", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfThreads %d", + "help_string": "Explicitly specify the maximum number of threads to use.", + }, + ), + ), + ] + output_fields = [ + ( + "outputMaximumGradientImage", + attr.ib( + type=File, + metadata={ + "help_string": "output gradient image file name", + "exists": "True", + }, + ), + ), + ( + "outputEdgeMap", + attr.ib( + type=File, + metadata={"help_string": "output edgemap file name", "exists": "True"}, + ), + ), + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GenerateEdgeMapImage", + executable=" GenerateEdgeMapImage ", + input_spec=input_spec, + output_spec=output_spec, + ) diff --git a/pydra/tasks/sem/surface.py b/pydra/tasks/sem/surface.py new file mode 100644 index 0000000..9b998ed --- /dev/null +++ b/pydra/tasks/sem/surface.py @@ -0,0 +1,716 @@ +""" +Autogenerated file - DO NOT EDIT +If you spot a bug, please report it on the mailing list and/or change the generator. +""" + +import attr +from nipype.interfaces.base import ( + Directory, + File, + InputMultiPath, + OutputMultiPath, + traits, +) +from pydra import ShellCommandTask +from pydra.engine.specs import SpecInfo, ShellSpec + + +class GrayscaleModelMaker: + """ + title: Grayscale Model Maker + category: Surface Models + description: Create 3D surface models from grayscale data. This module uses Marching Cubes to create an isosurface at a given threshold. The resulting surface consists of triangles that separate a volume into regions below and above the threshold. The resulting surface can be smoothed and decimated. This model works on continuous data while the module Model Maker works on labeled (or discrete) data. + version: 3.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/GrayscaleModelMaker + license: slicer3 + contributor: Nicole Aucoin (SPL, BWH), Bill Lorensen (GE) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "InputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Volume containing the input grayscale data.", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "OutputGeometry", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output that contains geometry model.", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ( + "threshold", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--threshold %f", + "help_string": "Grayscale threshold of isosurface. The resulting surface of triangles separates the volume into voxels that lie above (inside) and below (outside) the threshold.", + }, + ), + ), + ( + "name", + attr.ib( + type=traits.Str, + metadata={ + "argstr": "--name %s", + "help_string": "Name to use for this model.", + }, + ), + ), + ( + "smooth", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--smooth %d", + "help_string": "Number of smoothing iterations. If 0, no smoothing will be done.", + }, + ), + ), + ( + "decimate", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--decimate %f", + "help_string": "Target reduction during decimation, as a decimal percentage reduction in the number of polygons. If 0, no decimation will be done.", + }, + ), + ), + ( + "splitnormals", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--splitnormals ", + "help_string": "Splitting normals is useful for visualizing sharp features. However it creates holes in surfaces which affect measurements", + }, + ), + ), + ( + "pointnormals", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--pointnormals ", + "help_string": "Calculate the point normals? Calculated point normals make the surface appear smooth. Without point normals, the surface will appear faceted.", + }, + ), + ), + ( + "debug", + attr.ib( + type=traits.Bool, + metadata={ + "argstr": "--debug ", + "help_string": "Turn this flag on to log more details during execution.", + }, + ), + ), + ] + output_fields = [ + ( + "OutputGeometry", + attr.ib( + type=File, + metadata={ + "help_string": "Output that contains geometry model.", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="GrayscaleModelMaker", + executable=" GrayscaleModelMaker ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class LabelMapSmoothing: + """ + title: Label Map Smoothing + category: Surface Models + description: This filter smoothes a binary label map. With a label map as input, this filter runs an anti-alising algorithm followed by a Gaussian smoothing algorithm. The output is a smoothed label map. + version: 1.0 + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/LabelMapSmoothing + contributor: Dirk Padfield (GE), Josh Cates (Utah), Ross Whitaker (Utah) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. This filter is based on work developed at the University of Utah, and implemented at GE Research. + """ + + input_fields = [ + ( + "labelToSmooth", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--labelToSmooth %d", + "help_string": "The label to smooth. All others will be ignored. If no label is selected by the user, the maximum label in the image is chosen by default.", + }, + ), + ), + ( + "numberOfIterations", + attr.ib( + type=traits.Int, + metadata={ + "argstr": "--numberOfIterations %d", + "help_string": "The number of iterations of the level set AntiAliasing algorithm", + }, + ), + ), + ( + "maxRMSError", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--maxRMSError %f", + "help_string": "The maximum RMS error.", + }, + ), + ), + ( + "gaussianSigma", + attr.ib( + type=traits.Float, + metadata={ + "argstr": "--gaussianSigma %f", + "help_string": "The standard deviation of the Gaussian kernel", + }, + ), + ), + ( + "inputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input label map to smooth", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Smoothed label map", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "outputVolume", + attr.ib( + type=File, + metadata={ + "help_string": "Smoothed label map", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="LabelMapSmoothing", + executable=" LabelMapSmoothing ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class MergeModels: + """ + title: Merge Models + category: Surface Models + description: Merge the polydata from two input models and output a new model with the combined polydata. Uses the vtkAppendPolyData filter. Works on .vtp and .vtk surface files. + version: $Revision$ + documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/MergeModels + contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH), Daniel Haehn (SPL, BWH, UPenn) + acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149. + """ + + input_fields = [ + ( + "Model1", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input model 1", + "position": "-3", + "exists": "True", + }, + ), + ), + ( + "Model2", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Input model 2", + "position": "-2", + "exists": "True", + }, + ), + ), + ( + "ModelOutput", + attr.ib( + type=File, + metadata={ + "argstr": "%s", + "help_string": "Output model", + "position": "-1", + "hash_files": "False", + }, + ), + ), + ] + output_fields = [ + ( + "ModelOutput", + attr.ib( + type=File, + metadata={ + "help_string": "Output model", + "position": "-1", + "exists": "True", + }, + ), + ) + ] + + input_spec = SpecInfo(name="Input", fields=input_fields, bases=(ShellSpec,)) + output_spec = SpecInfo(name="Output", fields=output_fields, bases=(ShellSpec,)) + + task = ShellCommandTask( + name="MergeModels", + executable=" MergeModels ", + input_spec=input_spec, + output_spec=output_spec, + ) + + +class ModelMaker: + """ + title: Model Maker + category: Surface Models + description: Create 3D surface models from segmented data.Models are imported into Slicer under a model hierarchy node in a MRML scene. The model colors are set by the color table associated with the input volume (these colours will only be visible if you load the model scene file).
IO:
Specify an Input Volume that is a segmented label map volume. Create a new Models hierarchy to provide a structure to contain the return models created from the input volume.
Create Multiple:
If you specify a list of Labels, it will over ride any start/end label settings.
If you click Generate All it will over ride the list of labels and any start/end label settings.
Model Maker Parameters:
You can set the number of smoothing iterations, target reduction in number of polygons (decimal percentage). Use 0 and 1 if you wish no smoothing nor decimation.
You can set the flags to split normals or generate point normals in this pane as well.
You can save a copy of the models after intermediate steps (marching cubes, smoothing, and decimation if not joint smoothing, otherwise just after decimation); these models are not saved in the mrml file, turn off deleting temporary files first in the python window:
slicer.modules.modelmaker.cliModuleLogic().DeleteTemporaryFilesOff()
The ACPC line extends between two points, one at the anterior commissure and one at the posterior commissure. The resulting transform will bring the line connecting the two points horizontal to the AP axis.
The midline is a series of points (at least 3) defining the division between the hemispheres of the brain (the mid sagittal plane). The resulting transform will result in the output volume having the mid sagittal plane lined up with the AS plane.
Use the Filtering module Resample Scalar/Vector/DWI Volume to apply the transformation to a volume.
]]>IO:
Specify an Input Volume that is a segmented label map volume. Create a new Models hierarchy to provide a structure to contain the return models created from the input volume.
Create Multiple:
If you specify a list of Labels, it will over ride any start/end label settings.
If you click Generate All it will over ride the list of labels and any start/end label settings.
Model Maker Parameters:
You can set the number of smoothing iterations, target reduction in number of polygons (decimal percentage). Use 0 and 1 if you wish no smoothing nor decimation.
You can set the flags to split normals or generate point normals in this pane as well.
You can save a copy of the models after intermediate steps (marching cubes, smoothing, and decimation if not joint smoothing, otherwise just after decimation); these models are not saved in the mrml file, turn off deleting temporary files first in the python window:
slicer.modules.modelmaker.cliModuleLogic().DeleteTemporaryFilesOff()
Set image values to a user-specified outside value if they are below, above, or between simple threshold values.
ThresholdAbove: The values greater than or equal to the threshold value are set to OutsideValue.
ThresholdBelow: The values less than or equal to the threshold value are set to OutsideValue.
ThresholdOutside: The values outside the range Lower-Upper are set to OutsideValue.
]]>