Skip to content

Commit 9c076db

Browse files
authored
Merge pull request #1550 from BRAINSia/addToSemtools
Added to semtools
2 parents b9578ed + 598ff2a commit 9c076db

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import
33
from .segmentation import SimilarityIndex, BRAINSTalairach, BRAINSTalairachMask
4-
from .utilities import HistogramMatchingFilter
4+
from .utilities import HistogramMatchingFilter, GenerateEdgeMapImage, GeneratePurePlugMask
55
from .classify import BRAINSPosteriorToContinuousClass

nipype/interfaces/semtools/brains/utilities.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,69 @@ class HistogramMatchingFilter(SEMLikeCommandLine):
4646
_cmd = " HistogramMatchingFilter "
4747
_outputs_filenames = {'outputVolume': 'outputVolume.nii'}
4848
_redirect_x = False
49+
50+
class GenerateEdgeMapImageInputSpec(CommandLineInputSpec):
51+
inputMRVolumes = InputMultiPath(File(exists=True), desc="List of input structural MR volumes to create the maximum edgemap", argstr="--inputMRVolumes %s...")
52+
inputMask = File(desc="Input mask file name. If set, image histogram percentiles will be calculated within the mask", exists=True, argstr="--inputMask %s")
53+
minimumOutputRange = traits.Int(desc="Map lower quantile and below to minimum output range. It should be a small number greater than zero. Default is 1", argstr="--minimumOutputRange %d")
54+
maximumOutputRange = traits.Int(desc="Map upper quantile and above to maximum output range. Default is 255 that is the maximum range of unsigned char", argstr="--maximumOutputRange %d")
55+
lowerPercentileMatching = traits.Float(desc="Map lower quantile and below to minOutputRange. It should be a value between zero and one", argstr="--lowerPercentileMatching %f")
56+
upperPercentileMatching = traits.Float(desc="Map upper quantile and above to maxOutputRange. It should be a value between zero and one", argstr="--upperPercentileMatching %f")
57+
outputEdgeMap = traits.Either(traits.Bool, File(), hash_files=False, desc="output edgemap file name", argstr="--outputEdgeMap %s")
58+
outputMaximumGradientImage = traits.Either(traits.Bool, File(), hash_files=False, desc="output gradient image file name", argstr="--outputMaximumGradientImage %s")
59+
numberOfThreads = traits.Int(desc="Explicitly specify the maximum number of threads to use.", argstr="--numberOfThreads %d")
60+
61+
62+
class GenerateEdgeMapImageOutputSpec(TraitedSpec):
63+
outputEdgeMap = File(desc="(required) output file name", exists=True)
64+
outputMaximumGradientImage = File(desc="output gradient image file name", exists=True)
65+
66+
class GenerateEdgeMapImage(SEMLikeCommandLine):
67+
68+
"""title: GenerateEdgeMapImage
69+
70+
category: BRAINS.Utilities
71+
72+
description: Automatic edgemap generation for edge-guided super-resolution reconstruction
73+
74+
version: 1.0
75+
76+
contributor: Ali Ghayoor
77+
78+
"""
79+
80+
input_spec = GenerateEdgeMapImageInputSpec
81+
output_spec = GenerateEdgeMapImageOutputSpec
82+
_cmd = " GenerateEdgeMapImage "
83+
_outputs_filenames = {'outputEdgeMap': 'outputEdgeMap', 'outputMaximumGradientImage': 'outputMaximumGradientImage'}
84+
_redirect_x = False
85+
86+
class GeneratePurePlugMaskInputSpec(CommandLineInputSpec):
87+
inputImageModalities = InputMultiPath(File(exists=True), desc="List of input image file names to create pure plugs mask", argstr="--inputImageModalities %s...")
88+
threshold = traits.Float(desc="threshold value to define class membership", argstr="--threshold %f")
89+
numberOfSubSamples = InputMultiPath(traits.Int, desc="Number of continous index samples taken at each direction of lattice space for each plug volume", sep=",", argstr="--numberOfSubSamples %s")
90+
outputMaskFile = traits.Either(traits.Bool, File(), hash_files=False, desc="Output binary mask file name", argstr="--outputMaskFile %s")
91+
92+
93+
class GeneratePurePlugMaskOutputSpec(TraitedSpec):
94+
outputMaskFile = File(desc="(required) Output binary mask file name", exists=True)
95+
96+
class GeneratePurePlugMask(SEMLikeCommandLine):
97+
98+
"""title: GeneratePurePlugMask
99+
100+
category: BRAINS.Utilities
101+
102+
description: This program gets several modality image files and returns a binary mask that defines the pure plugs
103+
104+
version: 1.0
105+
106+
contributor: Ali Ghayoor
107+
108+
"""
109+
110+
input_spec = GeneratePurePlugMaskInputSpec
111+
output_spec = GeneratePurePlugMaskOutputSpec
112+
_cmd = " GeneratePurePlugMask "
113+
_outputs_filenames = {'outputMaskFile': 'outputMaskFile'}
114+
_redirect_x = False

0 commit comments

Comments
 (0)