allensdk.core.sitk_utilities module¶
- allensdk.core.sitk_utilities.fix_array_dimensions(array, ncomponents=1)[source]¶
Convenience function that reorders ndarray dimensions for io with SimpleITK
- Parameters:
- arraynp.ndarray
The array to be reordered
- ncomponentsint, optional
Number of components per pixel, default 1.
- Returns:
- np.ndarray
Reordered array
- allensdk.core.sitk_utilities.get_sitk_image_information(image)[source]¶
Extract information about a SimpleITK image
- Parameters:
- imagesitk.Image
Extract information about this image.
- Returns:
- dict
Extracted information. Includes spacing, origin, size, direction, and number of components per pixel
- allensdk.core.sitk_utilities.read_ndarray_with_sitk(path)[source]¶
Read a numpy array from a file using SimpleITK
- Parameters:
- pathstr
Read from this path
- Returns:
- imagenp.ndarray
Obtained array
- informationdict
Additional information about the array
- allensdk.core.sitk_utilities.set_sitk_image_information(image, information)[source]¶
Set information on a SimpleITK image
- Parameters:
- imagesitk.Image
Set information on this image.
- informationdict
Stores information to be set. Supports spacing, origin, direction. Also checks (but cannot set) size and number of components per pixel
- allensdk.core.sitk_utilities.write_ndarray_with_sitk(array, path, **information)[source]¶
Write a numpy array to a file using SimpleITK
- Parameters:
- arraynp.ndarray
Array to be written.
- pathstr
Write to here
- **informationdict
Contains additional information to be stored in the image file. See set_sitk_image_information for more information.