@@ -282,45 +282,3 @@ def read_img_data(img, prefer='scaled'):
282
282
if prefer == 'scaled' :
283
283
return hdr .data_from_fileobj (fileobj )
284
284
return hdr .raw_data_from_fileobj (fileobj )
285
-
286
-
287
- @deprecate_with_version ('which_analyze_type deprecated.' , '3.2' , '4.0' )
288
- def which_analyze_type (binaryblock ):
289
- """ Is `binaryblock` from NIfTI1, NIfTI2 or Analyze header?
290
-
291
- Parameters
292
- ----------
293
- binaryblock : bytes
294
- The `binaryblock` is 348 bytes that might be NIfTI1, NIfTI2, Analyze,
295
- or None of the the above.
296
-
297
- Returns
298
- -------
299
- hdr_type : str
300
- * a nifti1 header (pair or single) -> return 'nifti1'
301
- * a nifti2 header (pair or single) -> return 'nifti2'
302
- * an Analyze header -> return 'analyze'
303
- * None of the above -> return None
304
-
305
- Notes
306
- -----
307
- Algorithm:
308
-
309
- * read in the first 4 bytes from the file as 32-bit int ``sizeof_hdr``
310
- * if ``sizeof_hdr`` is 540 or byteswapped 540 -> assume nifti2
311
- * Check for 'ni1', 'n+1' magic -> assume nifti1
312
- * if ``sizeof_hdr`` is 348 or byteswapped 348 assume Analyze
313
- * Return None
314
- """
315
- from .nifti1 import header_dtype
316
- hdr_struct = np .ndarray (shape = (), dtype = header_dtype , buffer = binaryblock )
317
- bs_hdr_struct = hdr_struct .byteswap ()
318
- sizeof_hdr = hdr_struct ['sizeof_hdr' ]
319
- bs_sizeof_hdr = bs_hdr_struct ['sizeof_hdr' ]
320
- if 540 in (sizeof_hdr , bs_sizeof_hdr ):
321
- return 'nifti2'
322
- if hdr_struct ['magic' ] in (b'ni1' , b'n+1' ):
323
- return 'nifti1'
324
- if 348 in (sizeof_hdr , bs_sizeof_hdr ):
325
- return 'analyze'
326
- return None
0 commit comments