MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _get_spatial_shape

Method _get_spatial_shape

monai/data/image_reader.py:354–367  ·  view source on GitHub ↗

Get the spatial shape of `img`. Args: img: an ITK image object loaded from an image file.

(self, img)

Source from the content-addressed store, hash-verified

352 return affine
353
354 def _get_spatial_shape(self, img):
355 """
356 Get the spatial shape of `img`.
357
358 Args:
359 img: an ITK image object loaded from an image file.
360
361 """
362 sr = itk.array_from_matrix(img.GetDirection()).shape[0]
363 sr = max(min(sr, 3), 1)
364 _size = list(itk.size(img))
365 if isinstance(self.channel_dim, int):
366 _size.pop(self.channel_dim)
367 return np.asarray(_size[:sr])
368
369 def _get_array_data(self, img):
370 """

Callers 1

get_dataMethod · 0.95

Calls 3

maxFunction · 0.85
minFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected