Skip to content

Commit

Permalink
Merge branch 'roi'
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Apr 18, 2015
2 parents ca3d5ed + ea88e6e commit 126ef84
Show file tree
Hide file tree
Showing 23 changed files with 715 additions and 91 deletions.
Binary file removed 101509t1_10_degree_1_0003.dcm
Binary file not shown.
Binary file removed 101509t1_10_degree_1_0003_dcm.dcm
Binary file not shown.
7 changes: 4 additions & 3 deletions bin/qipipe
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def _parse_arguments():
# The actions.
parser.add_argument('--stage', dest='actions', action='append_const',
const='stage', help='stage the input DICOM files')
parser.add_argument('--roi', dest='actions', action='append_const',
const='roi', help='generate the ROI mask files')
parser.add_argument('--register', dest='actions', action='append_const',
const='register', help='register the scans')
parser.add_argument('--model', dest='actions', action='append_const',
Expand Down Expand Up @@ -115,10 +117,9 @@ def _parse_arguments():
help='the XNAT modeling resource name',
metavar='RESOURCE')

# The input subject directories or XNAT labels to process.
# The input directories or XNAT labels to process.
parser.add_argument('input', nargs='+',
help='the AIRC DICOM subject directory to stage'
' or XNAT session label to process')
help='the directory or XNAT session label to process')

args = vars(parser.parse_args())
nonempty_args = dict((k, v) for k, v in args.iteritems() if v != None)
Expand Down
3 changes: 3 additions & 0 deletions conf/roi.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[SGE]
# The Sun Grid Engine parameters.
plugin_args = {'qsub_args': '-l h_rt=0:30:00,mf=4G'}
2 changes: 2 additions & 0 deletions qipipe/interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .compress import Compress
from .copy import Copy
from .convert_bolero_mask import ConvertBoleroMask
from .fix_dicom import FixDicom
from .gate import Gate
from .group_dicom import GroupDicom
Expand All @@ -26,4 +27,5 @@
from .xnat_download import XNATDownload
from .xnat_upload import XNATUpload
from .xnat_find import XNATFind
# TODO - enable QuIP update
#from .update_qiprofile import UpdateQIProfile
53 changes: 53 additions & 0 deletions qipipe/interfaces/convert_bolero_mask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
This module wraps the proprietary OHSU AIRC ``bolero_mask_conv``
utility. ``bolero_mask_conv`` converts a proprietary OHSU format
mask file into a NiFTI mask file.
"""
import os
from os import path
from glob import glob
import traits.api as traits
from nipype.interfaces.base import (TraitedSpec, CommandLine,
CommandLineInputSpec)
from nipype.interfaces.traits_extension import Undefined


class ConvertBoleroMaskInputSpec(CommandLineInputSpec):
time_series = traits.File(desc='Input 4D DCE series NiFTI file',
mandatory=True, exists=True, position=1,
argstr='%s')
slice_index = traits.Int(desc='One-based slice index', mandatory=True,
position=2, argstr='%d')
in_file = traits.Int(desc='BOLERO .bqf mask file', mandatory=True,
position=3, argstr='%d')
out_base = traits.Str(desc='Output file base name without extension',
argstr='-o %s')


class ConvertBoleroMaskOutputSpec(TraitedSpec):
out_file = traits.File(desc='NiFTI mask file', exists=True)


class ConvertBoleroMask(CommandLine):
"""
Interface to the proprietary OHSU AIRC ``bolero_mask_conv`` utility.
"""

_cmd = 'bolero_mask_conv'
input_spec = ConvertBoleroMaskInputSpec
output_spec = ConvertBoleroMaskOutputSpec

def __init__(self, **inputs):
super(ConvertBoleroMask, self).__init__(**inputs)

def _list_outputs(self):
outputs = self._outputs().get()

# The default output base name is slice_<slice>_lesion.
out_base = self.inputs.out_base or "slice_%d_lesion" % self.inputs.slice_index
# The output is compressed.
out_file = out_base + '.nii.gz'
# Expand the output path.
outputs['out_file'] = os.path.abspath(out_file)

return outputs

0 comments on commit 126ef84

Please sign in to comment.