|
81 | 81 | can be loaded with and without a default flip, so the saved zoom will not |
82 | 82 | constrain the affine. |
83 | 83 | """ |
| 84 | +from __future__importannotations |
| 85 | + |
| 86 | +fromtypingimportType |
84 | 87 |
|
85 | 88 | importnumpyasnp |
86 | 89 |
|
87 | 90 | from .arrayproxyimportArrayProxy |
88 | 91 | from .arraywritersimportArrayWriter,WriterError,get_slope_inter,make_array_writer |
89 | 92 | from .batteryrunnersimportReport |
90 | 93 | from .fileholdersimportcopy_file_map |
91 | | -from .spatialimagesimportHeaderDataError,HeaderTypeError,SpatialImage |
| 94 | +from .spatialimagesimportHeaderDataError,HeaderTypeError,SpatialHeader,SpatialImage |
92 | 95 | from .volumeutilsimport ( |
93 | 96 | apply_read_scaling, |
94 | 97 | array_from_file, |
|
131 | 134 | ('glmax','i4'), |
132 | 135 | ('glmin','i4'), |
133 | 136 | ] |
134 | | -data_history_dtd= [ |
| 137 | +data_history_dtd:list[tuple[str,str]|tuple[str,str,tuple[int, ...]]]= [ |
135 | 138 | ('descrip','S80'), |
136 | 139 | ('aux_file','S24'), |
137 | 140 | ('orient','S1'), |
|
172 | 175 | data_type_codes=make_dt_codes(_dtdefs) |
173 | 176 |
|
174 | 177 |
|
175 | | -classAnalyzeHeader(LabeledWrapStruct): |
| 178 | +classAnalyzeHeader(LabeledWrapStruct,SpatialHeader): |
176 | 179 | """Class for basic analyze header |
177 | 180 |
|
178 | 181 | Implements zoom-only setting of affine transform, and no image |
@@ -892,11 +895,11 @@ def may_contain_header(klass, binaryblock): |
892 | 895 | classAnalyzeImage(SpatialImage): |
893 | 896 | """Class for basic Analyze format image""" |
894 | 897 |
|
895 | | -header_class=AnalyzeHeader |
| 898 | +header_class:Type[AnalyzeHeader]=AnalyzeHeader |
896 | 899 | _meta_sniff_len=header_class.sizeof_hdr |
897 | | -files_types= (('image','.img'), ('header','.hdr')) |
898 | | -valid_exts= ('.img','.hdr') |
899 | | -_compressed_suffixes= ('.gz','.bz2','.zst') |
| 900 | +files_types:tuple[tuple[str,str], ...]= (('image','.img'), ('header','.hdr')) |
| 901 | +valid_exts:tuple[str, ...]= ('.img','.hdr') |
| 902 | +_compressed_suffixes:tuple[str, ...]= ('.gz','.bz2','.zst') |
900 | 903 |
|
901 | 904 | makeable=True |
902 | 905 | rw=True |
|