2.1.1.1.2. sf_tools.base.transform module

DATA TRANSFORM ROUTINES

This module contains methods for transforming data.

Author:Samuel Farrens <samuel.farrens@gmail.com>
Version:1.2
Date:20/10/2017
sf_tools.base.transform.cube2map(data_cube, layout)[source]

Cube to Map

This method transforms the input data from a 3D cube to a 2D map with a specified layout

Parameters:
  • data_cube (np.ndarray) – Input data cube, 3D array of 2D images
  • Layout (tuple) – 2D layout of 2D images
Returns:

Return type:

np.ndarray 2D map

Raises:

ValueError – For invalid layout

sf_tools.base.transform.map2cube(data_map, layout)[source]

Map to cube

This method transforms the input data from a 2D map with given layout to a 3D cube

Parameters:
  • data_map (np.ndarray) – Input data map, 2D array
  • layout (tuple) – 2D layout of 2D images
Returns:

Return type:

np.ndarray 3D cube

Raises:

ValueError – For invalid layout

sf_tools.base.transform.map2matrix(data_map, layout)[source]

Map to Matrix

This method transforms a 2D map to a 2D matrix

Parameters:
  • data_map (np.ndarray) – Input data map, 2D array
  • layout (tuple) – 2D layout of 2D images
Returns:

Return type:

np.ndarray 2D matrix

Raises:

ValueError – For invalid layout

sf_tools.base.transform.matrix2map(data_matrix, map_shape)[source]

Matrix to Map

This method transforms a 2D matrix to a 2D map

Parameters:
  • data_matrix (np.ndarray) – Input data matrix, 2D array
  • map_shape (tuple) – 2D shape of the output map
Returns:

Return type:

np.ndarray 2D map

Raises:

ValueError – For invalid layout

sf_tools.base.transform.cube2matrix(data_cube)[source]

Cube to Matrix

This method transforms a 3D cube to a 2D matrix

Parameters:data_cube (np.ndarray) – Input data cube, 3D array
Returns:
Return type:np.ndarray 2D matrix
sf_tools.base.transform.matrix2cube(data_matrix, im_shape)[source]

Matrix to Cube

This method transforms a 2D matrix to a 3D cube

Parameters:
  • data_matrix (np.ndarray) – Input data cube, 2D array
  • im_shape (tuple) – 2D shape of the individual images
Returns:

Return type:

np.ndarray 3D cube