utils¶
Image¶
-
class
airlab.utils.image.
Displacement
(*args, **kwargs)¶ -
itk
()¶ Returns a SimpleITK image
Note: the order of axis is flipped back to the convention of SimpleITK
-
magnitude
()¶
-
numpy
()¶ Returns a numpy array
-
static
read
(filename, dtype=torch.float32, device='cpu')¶ Static method to directly read a displacement field through the Image class
filename (str): filename of the displacement field dtype: specific dtype for representing the tensor device: on which device the displacement field has to be allocated return (Displacement): an airlab displacement field
-
-
class
airlab.utils.image.
Image
(*args, **kwargs)¶ Class representing an image in airlab
-
initializeForImages
(sitk_image, dtype=None, device='cpu')¶ Constructor for SimpleITK image
Note: the order of axis are flipped in order to follow the convention of numpy and torch
sitk_image (sitk.SimpleITK.Image): SimpleITK image dtype: pixel type device (‘cpu’|’cuda’): on which device the image should be allocated return (Image): an airlab image object
-
initializeForTensors
(tensor_image, image_size, image_spacing, image_origin)¶ Constructor for torch tensors and numpy ndarrays
Args: tensor_image (np.ndarray | th.Tensor): n-dimensional tensor, where the last dimensions are the image dimensions while the preceeding dimensions need to empty image_size (array | list | tuple): number of pixels in each space dimension image_spacing (array | list | tuple): pixel size for each space dimension image_origin (array | list | tuple): physical coordinate of the first pixel :return (Image): an airlab image object
-
itk
()¶ Returns a SimpleITK image
Note: the order of axis is flipped back to the convention of SimpleITK
-
numpy
()¶ Returns a numpy array
-
static
read
(filename, dtype=torch.float32, device='cpu')¶ Static method to directly read an image through the Image class
filename (str): filename of the image dtype: specific dtype for representing the tensor device: on which device the image has to be allocated return (Image): an airlab image
-
to
(dtype=None, device='cpu')¶ Converts the image tensor to a specified dtype and moves it to the specified device
-
write
(filename)¶ Write an image to hard drive
Note: order of axis are flipped to have the representation of SimpleITK again
filename (str): filename where the image is written
-
-
airlab.utils.image.
create_displacement_image_from_image
(tensor_displacement, image)¶
-
airlab.utils.image.
create_image_from_image
(tensor_image, image)¶
-
airlab.utils.image.
create_image_pyramid
(image, down_sample_factor)¶
-
airlab.utils.image.
create_tensor_image_from_itk_image
(itk_image, dtype=torch.float32, device='cpu')¶
-
airlab.utils.image.
flip
(x, dim)¶ Flip order of a specific dimension dim
x (Tensor): input tensor dim (int): axis which should be flipped return (Tensor): returns the tensor with the specified axis flipped
-
airlab.utils.image.
image_from_numpy
(image, pixel_spacing, image_origin, dtype=torch.float32, device='cpu')¶
-
airlab.utils.image.
read_image_as_tensor
(filename, dtype=torch.float32, device='cpu')¶
Kernel Function¶
-
airlab.utils.kernelFunction.
bspline_kernel
(sigma, order=2, dim=1, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
bspline_kernel_1d
(sigma, order=2, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
bspline_kernel_2d
(sigma=[1, 1], order=2, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
bspline_kernel_3d
(sigma=[1, 1, 1], order=2, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
gaussian_kernel
(sigma, dim=1, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
gaussian_kernel_1d
(sigma, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
gaussian_kernel_2d
(sigma, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
gaussian_kernel_3d
(sigma, asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
wendland_kernel
(sigma, dim=1, type='C4', asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
wendland_kernel_1d
(sigma, type='C4', asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
wendland_kernel_2d
(sigma, type='C4', asTensor=False, dtype=torch.float32, device='cpu')¶
-
airlab.utils.kernelFunction.
wendland_kernel_3d
(sigma, type='C4', asTensor=False, dtype=torch.float32, device='cpu')¶
Matrix¶
-
class
airlab.utils.matrix.
LaplaceMatrix
(number_of_nodes, diag_elements, dtype=torch.float32, device='cpu')¶ -
full
()¶
-
update
()¶
-
-
class
airlab.utils.matrix.
MatrixDiagonalElement
(edge_index, edge_values, offset, dtype=torch.float32, device='cpu')¶
-
airlab.utils.matrix.
band_mv
(A, x)¶
-
airlab.utils.matrix.
expm_eig
(A)¶
-
airlab.utils.matrix.
expm_krylov
(A, x, phi=1, krylov_dim=30, inplace=True)¶