niworkflows.interfaces.header module¶
Handling NIfTI headers.
- class niworkflows.interfaces.header.CopyHeader(from_file=None, resource_monitor=None, **inputs)[source]¶
Bases:
SimpleInterface
Copy 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:
SimpleInterface
Copy the x-form orientation headers from
hdr_file
to an arbitrary set of images.Target images that will get their x-form headers replaced should be prescribed using the
fields
argument 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:
SimpleInterface
Check 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:
¶ valid quaternions
qform_code
> 0sform_code
> 0qform == sform
actions
True
True
True
True
None
True
True
False
*
sform, scode <- qform, qcode
*
True
*
False
sform, scode <- qform, qcode
*
False
True
*
qform, qcode <- sform, scode
*
False
False
*
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:
SimpleInterface
Check the correctness of x-form headers (matrix and code).
This interface implements the following logic:
¶ valid quaternions
qform_code
> 0sform_code
> 0qform == sform
actions
True
True
True
True
None
True
True
False
*
sform, scode <- qform, qcode
*
*
True
False
qform, qcode <- sform, scode
*
False
True
*
qform, qcode <- sform, scode
*
False
False
*
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.