niworkflows.interfaces.header module¶
Handling NIfTI headers.
- class niworkflows.interfaces.header.CopyHeader(from_file=None, resource_monitor=None, **inputs)[source]¶
Bases:
SimpleInterfaceCopy a header from the hdr_file to out_file with data drawn from in_file.
- Mandatory Inputs:
hdr_file (a pathlike object or string representing an existing file) – The file we get the header from.
in_file (a pathlike object or string representing an existing file) – The file we get the data from.
- Outputs:
out_file (a pathlike object or string representing an existing file) – Written file path.
- class niworkflows.interfaces.header.CopyXForm(fields=None, **inputs)[source]¶
Bases:
SimpleInterfaceCopy the x-form orientation headers from
hdr_fileto an arbitrary set of images.Target images that will get their x-form headers replaced should be prescribed using the
fieldsargument at interface instantiation.- Mandatory Inputs:
hdr_file (a pathlike object or string representing an existing file) – The file we get the header from.
- output_spec¶
alias of
DynamicTraitedSpec
- class niworkflows.interfaces.header.MatchHeader(from_file=None, resource_monitor=None, **inputs)[source]¶
Bases:
SimpleInterface- Mandatory Inputs:
in_file (a pathlike object or string representing an existing file) – NIfTI file which header will be checked.
reference (a pathlike object or string representing an existing file) – NIfTI file with reference header.
- Outputs:
out_file (a pathlike object or string representing an existing file) – NIfTI file with fixed header.
- class niworkflows.interfaces.header.SanitizeImage(from_file=None, resource_monitor=None, **inputs)[source]¶
Bases:
SimpleInterfaceCheck the correctness of x-form headers (matrix and code) and fixes problematic combinations of values. Removes any extension form the header if present. This interface implements the following logic:
SanitizeImagetruth table¶valid quaternions
qform_code> 0sform_code> 0qform == sformactions
TrueTrueTrueTrueNone
TrueTrueFalse*
sform, scode <- qform, qcode
*
True*
Falsesform, scode <- qform, qcode
*
FalseTrue*
qform, qcode <- sform, scode
*
FalseFalse*
sform, qform <- best affine; scode, qcode <- 1
False*
False*
sform, qform <- best affine; scode, qcode <- 1
- Mandatory Inputs:
in_file (a pathlike object or string representing an existing file) – Input image.
- Optional Inputs:
max_32bit (a boolean) – Cast data to float32 if higher precision is encountered. (Nipype default value:
False)n_volumes_to_discard (an integer) – Discard n first volumes. (Nipype default value:
0)
- Outputs:
out_file (a pathlike object or string representing an existing file) – Validated image.
out_report (a pathlike object or string representing an existing file) – HTML segment containing warning.
- class niworkflows.interfaces.header.ValidateImage(from_file=None, resource_monitor=None, **inputs)[source]¶
Bases:
SimpleInterfaceCheck the correctness of x-form headers (matrix and code).
This interface implements the following logic:
ValidateImagetruth table¶valid quaternions
qform_code> 0sform_code> 0qform == sformactions
TrueTrueTrueTrueNone
TrueTrueFalse*
sform, scode <- qform, qcode
*
*
TrueFalseqform, qcode <- sform, scode
*
FalseTrue*
qform, qcode <- sform, scode
*
FalseFalse*
sform, qform <- best affine; scode, qcode <- 1
False*
False*
sform, qform <- best affine; scode, qcode <- 1
- Mandatory Inputs:
in_file (a pathlike object or string representing an existing file) – Input image.
- Outputs:
out_file (a pathlike object or string representing an existing file) – Validated image.
out_report (a pathlike object or string representing an existing file) – HTML segment containing warning.