# `tomopy.misc.morph`¶

Module for data size morphing functions.

Functions:

 `downsample`(arr[, level, axis]) Downsample along specified axis of a 3D array. `upsample`(arr[, level, axis]) Upsample along specified axis of a 3D array. `pad`(arr, axis[, npad, mode, ncore]) Pad an array along specified axis. `sino_360_t0_180`(data[, overlap, rotation]) Converts 0-360 degrees sinogram to a 0-180 sinogram. `trim_sinogram`(data, center, x, y, diameter) Provide sinogram corresponding to a circular region of interest by trimming the complete sinogram of a compact object.
tomopy.misc.morph.downsample(arr, level=1, axis=2)[source]

Downsample along specified axis of a 3D array.

Parameters:
• arr (ndarray) – 3D input array.

• level (int, optional) – Downsampling level in powers of two.

• axis (int, optional) – Axis along which downsampling will be performed.

Returns:

ndarray – Downsampled 3D array in float32.

Pad an array along specified axis.

Parameters:
• arr (ndarray) – Input array.

• axis (int) – Axis along which padding will be performed.

• mode (str or function) – One of the following string values or a user supplied function.

‘constant’

‘edge’

Pads with the edge values of array.

• constant_values (float, optional) – Used in ‘constant’. Pad value

• ncore (int, optional) – Number of cores that will be assigned to jobs.

Returns:

tomopy.misc.morph.sino_360_t0_180(data, overlap=0, rotation='left')

Converts 0-360 degrees sinogram to a 0-180 sinogram.

If the number of projections in the input data is odd, the last projection will be discarded.

Parameters:
• data (ndarray) – Input 3D data.

• overlap (scalar, optional) – Overlapping number of pixels.

• rotation (string, optional) – Left if rotation center is close to the left of the field-of-view, right otherwise.

Returns:

ndarray – Output 3D data.

tomopy.misc.morph.sino_360_to_180(data, overlap=0, rotation='left')[source]

Converts 0-360 degrees sinogram to a 0-180 sinogram.

If the number of projections in the input data is odd, the last projection will be discarded.

Parameters:
• data (ndarray) – Input 3D data.

• overlap (scalar, optional) – Overlapping number of pixels.

• rotation (string, optional) – Left if rotation center is close to the left of the field-of-view, right otherwise.

Returns:

ndarray – Output 3D data.

tomopy.misc.morph.trim_sinogram(data, center, x, y, diameter)[source]

Provide sinogram corresponding to a circular region of interest by trimming the complete sinogram of a compact object.

Parameters:
• data (ndarray) – Input 3D data.

• center (float) – Rotation center location.

• x, y (int, int) – x and y coordinates in pixels (image center is (0, 0))

• diameter (float) – Diameter of the circle of the region of interest.

Returns:

ndarray – Output 3D data.

tomopy.misc.morph.upsample(arr, level=1, axis=2)[source]

Upsample along specified axis of a 3D array.

Parameters:
• arr (ndarray) – 3D input array.

• level (int, optional) – Downsampling level in powers of two.

• axis (int, optional) – Axis along which upsampling will be performed.

Returns:

ndarray – Upsampled 3D array in float32.
{"ft_lang_label":"__label__en","ft_lang_prob":0.53462833,"math_prob":0.9567732,"size":3124,"snap":"2023-40-2023-50","text_gpt3_token_len":842,"char_repetition_ratio":0.12083333,"word_repetition_ratio":0.53125,"special_character_ratio":0.26728553,"punctuation_ratio":0.1903945,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97002274,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-25T10:24:58Z\",\"WARC-Record-ID\":\"<urn:uuid:e76bc5cd-28dd-4631-bcdf-88bbc62551af>\",\"Content-Length\":\"50304\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8c997cda-53c9-43ad-b43d-adacd1bd33a7>\",\"WARC-Concurrent-To\":\"<urn:uuid:fab79de7-d80d-4ad8-877b-d23815fac4c2>\",\"WARC-IP-Address\":\"104.17.32.82\",\"WARC-Target-URI\":\"https://tomopy.readthedocs.io/en/v1.14.0/api/tomopy.misc.morph.html\",\"WARC-Payload-Digest\":\"sha1:OSIGW5OEEVP225NATBHSVDM5DTTAKZJJ\",\"WARC-Block-Digest\":\"sha1:574OOTO2XIMVQAWQL6XYBJOQCLMBNZTP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233508959.20_warc_CC-MAIN-20230925083430-20230925113430-00312.warc.gz\"}"}