digraph inheritance6d2e08605d { rankdir=LR; ratio=compress; fontsize=14; size="6.0, 8.0"; "SpatialImage" [shape=ellipse,URL="nibabel.spatialimages.SpatialImage.html#nibabel.spatialimages.SpatialImage",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "AnalyzeImage" [shape=ellipse,URL="#nibabel.analyze.AnalyzeImage",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "SpatialImage" -> "AnalyzeImage" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
Initialize image
The image is a combination of (array, affine matrix, header), with optional metadata in extra, and filename / file-like objects contained in the file_map mapping.
Parameters : | data : array-like
affine : None or (4,4) array-like
header : None or mapping or header instance, optional
extra : None or mapping, optional
file_map : mapping, optional
|
---|
Analyze-type implemention of array proxy protocol
The array proxy allows us to freeze the passed fileobj and header such that it returns the expected data array.
class method to create image from mapping in file_map `
Return header
alias of AnalyzeHeader
Write image to file_map or contained self.file_map
Parameters : | file_map : None or mapping, optional
|
---|
Harmonize header with image data and affine
>>> data = np.zeros((2,3,4))
>>> affine = np.diag([1.0,2.0,3.0,1.0])
>>> img = AnalyzeImage(data, affine)
>>> hdr = img.get_header()
>>> img.get_shape()
(2, 3, 4)
>>> img.update_header()
>>> hdr.get_data_shape()
(2, 3, 4)
>>> hdr.get_zooms()
(1.0, 2.0, 3.0)