interfaces¶
interfaces
Package¶
The interfaces
module includes the custom Nipype interface classes.
As a convenience, this interfaces
module imports all of the
non-proprietary interface classes. The proprietary interface class
qipipe.interfaces.fastfit.Fastfit
must be imported
separately from the qipipe.interfaces.fastfit
module, e.g.:
from qipipe.interfaces.fastfit import Fastfit
Importing fastfit
in an environment that does not provide the
fastfit application will raise an ImportError.
compress
¶
convert_bolero_mask
¶
OHSU - 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.
copy
¶
-
class
qipipe.interfaces.copy.
Copy
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The Copy interface copies a file to a destination directory.
dce_to_r1
¶
OHSU - This module wraps the proprietary OHSU AIRC dce_to_r1
utility.
-
class
qipipe.interfaces.dce_to_r1.
DceToR1
(**inputs)¶ Bases:
nipype.interfaces.base.CommandLine
Convert a T1-weighted DCE time series of signal intensities to a series of R1 values.
-
__init__
(**inputs)¶
-
-
qipipe.interfaces.dce_to_r1.
MASK_FILE_NAME
= 'valid_mask.nii.gz'¶ The dce_to_r1 output mask file base name.
-
qipipe.interfaces.dce_to_r1.
OUTPUT_FILE_NAME
= 'r1_series.nii.gz'¶ The dce_to_r1 output R1 file base name.
fastfit
¶
OHSU - This module wraps the proprietary OHSU AIRC fastfit
software. fastfit
optimizes the input pharmacokinetic model.
Note
this interface is adapted from the OHSU AIRC cluster file
/usr/global/scripts/fastfit_iface.py
.
fix_dicom
¶
-
class
qipipe.interfaces.fix_dicom.
FixDicom
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The FixDicom interface wraps the
qipipe.staging.fix_dicom.fix_dicom_headers()
function.
group_dicom
¶
interface_error
¶
lookup
¶
-
class
qipipe.interfaces.lookup.
Lookup
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.io.IOBase
The Lookup Interface wraps a dictionary look-up.
Example:
>>> from qipipe.interfaces import Lookup >>> lookup = Lookup(key='a', dictionary=dict(a=1, b=2)) >>> result = lookup.run() >>> result.outputs.value 1
map_ctp
¶
Maps the DICOM Patient IDs to the CTP Patient IDs.
-
class
qipipe.interfaces.map_ctp.
MapCTP
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The MapCTP interface wraps the
qipipe.interfaces.map_ctp.map_ctp()
method.
move
¶
-
class
qipipe.interfaces.move.
Move
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The Move interface moves a file to a destination using
shutil.move
. Unlikeshutil.move
, the dest parent directory is created if it does not yet exist (likemkdir -p
).
mri_volcluster
¶
-
class
qipipe.interfaces.mri_volcluster.
MriVolCluster
(command=None, **inputs)¶ Bases:
nipype.interfaces.base.CommandLine
MriVolCluster encapsulates the FSL mri_volcluster command.
preview
¶
-
class
qipipe.interfaces.preview.
Preview
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
Preview creates a JPEG image from an input DICOM image.
reorder_bolero_mask
¶
This module reorders the OHSU AIRC bolero_mask_conv
result to conform with the time series x and y order.
-
class
qipipe.interfaces.reorder_bolero_mask.
ReorderBoleroMask
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
Interface to the ROI reordering utility.
sticky_identity
¶
-
class
qipipe.interfaces.sticky_identity.
StickyIdentityInterface
(fields=None, mandatory_inputs=True, **inputs)¶ Bases:
nipype.interfaces.io.IOBase
The StickyIdentityInterface interface class is a copy of the Nipype IdentityInterface. Since Nipype over-zealously elides IdentityInterface nodes from the execution graph, IdentityInterface cannot be used to capture workflow output nor to constrain execution order, as in the examples below. StickyIdentityInterface is an IdentityInterface look-alike that preserves the node connection in the execution graph.
Example:
>> from qipipe.interfaces import StickyIdentityInterface >> gate = Node(StickyIdentityInterface(fields=['a', 'b'])) >> workflow.connect(upstream1, 'a', gate, 'a') >> workflow.connect(upstream2, 'b', gate, 'b') >> workflow.connect(gate, 'a', downstream, 'a')
In this example, the
gate
node starts after bothupstream1
andupstream2
finish. Consequently, thedownstream
node starts only after bothupstream1
andupstream2
finish. This execution precedence constraint does not hold if gate were an IdentityInterface.Example:
>> from qipipe.interfaces import StickyIdentityInterface >> output_spec = Node(StickyIdentityInterface(fields=['a'])) >> workflow.connect(upstream, 'a', output_spec, 'a') >> upstream.inputs.a = 1 >> # The magic incantation to get a Nipype workflow output. >> wf_res = workflow.run() >> output_res = next(n for n in wf_res.nodes() ... if n.name == 'output_spec') >> output_res.inputs.get()['a'] 1 >> # But, oddly: >> output_res.outputs.get()['a'] # bad! <undefined>
Note
a better solution is to set a preserve flag on IdentityInterface. If this solution is implemented by Nipype, then this
StickyIdentityInterface
class will be deprecated.-
__init__
(fields=None, mandatory_inputs=True, **inputs)¶
-
input_spec
¶ alias of
DynamicTraitedSpec
-
output_spec
¶ alias of
DynamicTraitedSpec
-
touch
¶
-
class
qipipe.interfaces.touch.
Touch
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The Touch interface emulates the Unix
touch
command. This interface is useful for stubbing out processing nodes during workflow development.
uncompress
¶
unpack
¶
-
class
qipipe.interfaces.unpack.
Unpack
(input_name, output_names, mandatory_inputs=True, **inputs)¶ Bases:
nipype.interfaces.io.IOBase
The Unpack Interface converts a list input field to one output field per list item.
Example:
>>> from qipipe.interfaces.unpack import Unpack >>> unpack = Unpack(input_name='list', output_names=['a', 'b'], list=[1, 2]) >>> result = unpack.run() >>> result.outputs.a 1 >>> result.outputs.b 2
Parameters: - input_name – the input list field name
- output_names – the output field names
- mandatory_inputs – a flag indicating whether every input field is required
- inputs – the input field name => value bindings
-
__init__
(input_name, output_names, mandatory_inputs=True, **inputs)¶ Parameters: - input_name – the input list field name
- output_names – the output field names
- mandatory_inputs – a flag indicating whether every input field is required
- inputs – the input field name => value bindings
-
input_spec
¶ alias of
DynamicTraitedSpec
-
output_spec
¶ alias of
DynamicTraitedSpec
update_qiprofile
¶
-
class
qipipe.interfaces.update_qiprofile.
UpdateQIProfile
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The
UpdateQIProfile
Nipype interface updates the Imaging Profile database.
xnat_copy
¶
-
class
qipipe.interfaces.xnat_copy.
XNATCopy
(command=None, **inputs)¶ Bases:
nipype.interfaces.base.CommandLine
The
XNATCopy
Nipype interface wraps thecpxnat
command.-
input_spec
¶ alias of
XNATCopyInputSpec
-
-
class
qipipe.interfaces.xnat_copy.
XNATCopyInputSpec
(**kwargs)¶ Bases:
nipype.interfaces.base.CommandLineInputSpec
The input spec with arguments in the following order: * options * the input files, for an upload * the XNAT object path * the destination directory, for a download
Initialize handlers and inputs
xnat_download
¶
-
qipipe.interfaces.xnat_download.
CONTAINER_OPTS
= ['container_type', 'scan', 'reconstruction', 'assessor']¶ The download input container options.
-
class
qipipe.interfaces.xnat_download.
XNATDownload
(from_file=None, **inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The
XNATDownload
Nipype interface wraps theqixnat.facade.XNAT.download()
method.Note
only one XNAT operation can run at a time.
Examples:
>>> # Download the scan NIfTI files. >>> from qipipe.interfaces import XNATDownload >>> XNATDownload(project='QIN', subject='Breast003', ... session='Session02', scan=1, resource='NIFTI', ... dest='data').run()
>>> # Download the scan DICOM files. >>> from qipipe.interfaces import XNATDownload >>> XNATDownload(project='QIN', subject='Breast003', ... session='Session02', scan=1, resource='DICOM', ... dest='data').run()
>>> # Download the registration reg_H3pIz4s images. >>> from qipipe.interfaces import XNATDownload >>> XNATDownload(project='QIN', subject='Breast003', ... session='Session02', resource='reg_H3pIz4', ... dest='data').run()
xnat_find
¶
-
class
qipipe.interfaces.xnat_find.
XNATFind
(**inputs)¶ Bases:
nipype.interfaces.base.BaseInterface
The
XNATFind
Nipype interface wraps theqixnat.facade.XNAT
find_one
andfind_or_create
methods.Note
concurrent XNAT operations can fail. See the
qipipe.pipeline.staging.StagingWorkflow
note.-
__init__
(**inputs)¶
-