fepegar / torchio

@@ -50,7 +50,7 @@
Loading
50 50
        >>> ref_path = tio.datasets.Colin27().t1.path  # this image is in the MNI space, so we can use it as reference/target
51 51
        >>> affine_matrix = tio.io.read_matrix('transform_to_mni.txt')  # from a NiftyReg registration. Would also work with e.g. .tfm from SimpleITK
52 52
        >>> image = tio.ScalarImage(tensor=torch.rand(1, 256, 256, 180), to_mni=affine_matrix)  # 'to_mni' is an arbitrary name
53 -
        >>> transform = tio.Resample(colin.t1.path, pre_affine_name='to_mni')
53 +
        >>> transform = tio.Resample(colin.t1.path, pre_affine_name='to_mni')  # nearest neighbor interpolation is used for label maps
54 54
        >>> transformed = transform(image)  # "image" is now in the MNI space
55 55
    """  # noqa: E501
56 56
    def __init__(

@@ -585,8 +585,6 @@
Loading
585 585
class LabelMap(Image):
586 586
    """Image whose pixel values represent categorical labels.
587 587
588 -
    Intensity transforms are not applied to these images.
589 -
590 588
    Example:
591 589
        >>> import torch
592 590
        >>> import torchio as tio
@@ -598,6 +596,12 @@
Loading
598 596
        ...     'csf.nii.gz',
599 597
        ... )
600 598
599 +
    Intensity transforms are not applied to these images.
600 +
601 +
    Nearest neighbor interpolation is always used to resample label maps,
602 +
    independently of the specified interpolation type in the transform
603 +
    instantiation.
604 +
601 605
    See :class:`~torchio.Image` for more information.
602 606
    """
603 607
    def __init__(self, *args, **kwargs):

@@ -4,13 +4,15 @@
Loading
4 4
import SimpleITK as sitk
5 5
6 6
7 -
@enum.unique
8 7
class Interpolation(enum.Enum):
9 8
    """Interpolation techniques available in ITK.
10 9
10 +
    For a full quantitative comparison of interpolation methods, you can read
11 +
    `Meijering et al. 1999, Quantitative Comparison of Sinc-Approximating Kernels for Medical Image Interpolation <https://link.springer.com/chapter/10.1007/10704282_23>`_
12 +
11 13
    Example:
12 14
        >>> import torchio as tio
13 -
        >>> transform = tio.RandomAffine(image_interpolation='nearest')
15 +
        >>> transform = tio.RandomAffine(image_interpolation='bspline')
14 16
    """
15 17
    #: Interpolates image intensity at a non-integer pixel position by copying the intensity for the nearest neighbor.
16 18
    NEAREST: str = 'sitkNearestNeighbor'
@@ -18,23 +20,39 @@
Loading
18 20
    #: Linearly interpolates image intensity at a non-integer pixel position.
19 21
    LINEAR: str = 'sitkLinear'
20 22
21 -
    #: Computes the B-spline interpolation weights over the support region of the B-spline.
23 +
    #: B-Spline of order 3 (cubic) interpolation.
22 24
    BSPLINE: str = 'sitkBSpline'
23 25
26 +
    #: Same as ``nearest``.
27 +
    CUBIC: str = 'sitkBSpline'
28 +
29 +
    #: Gaussian interpolation. Sigma is set to 0.8 input pixels and alpha is 4
24 30
    GAUSSIAN: str = 'sitkGaussian'
31 +
32 +
    #: Smoothly interpolate multi-label images. Sigma is set to 1 input pixel and alpha is 1
25 33
    LABEL_GAUSSIAN: str = 'sitkLabelGaussian'
26 34
35 +
    #: Hamming windowed sinc kernel.
27 36
    HAMMING: str = 'sitkHammingWindowedSinc'
37 +
38 +
    #: Cosine windowed sinc kernel.
28 39
    COSINE: str = 'sitkCosineWindowedSinc'
40 +
41 +
    #: Welch windowed sinc kernel.
29 42
    WELCH: str = 'sitkWelchWindowedSinc'
43 +
44 +
    #: Lanczos windowed sinc kernel.
30 45
    LANCZOS: str = 'sitkLanczosWindowedSinc'
46 +
47 +
    #: Blackman windowed sinc kernel.
31 48
    BLACKMAN: str = 'sitkBlackmanWindowedSinc'
32 49
33 50
34 51
def get_sitk_interpolator(interpolation: str) -> int:
35 52
    if not isinstance(interpolation, str):
36 53
        message = (
37 -
            f'Interpolation must be a string, not {type(interpolation)}'
54 +
            f'Interpolation must be a string, not "{interpolation}"'
55 +
            f' of type {type(interpolation)}'
38 56
        )
39 57
        raise ValueError(message)
40 58
    string = getattr(Interpolation, interpolation.upper()).value
Files Coverage
tests 99.77%
torchio 95.27%
print_system.py 0.00%
Project Totals (120 files) 96.69%
1929.3
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
1929.2
TRAVIS_PYTHON_VERSION=3.7
TRAVIS_OS_NAME=linux
1929.1
TRAVIS_PYTHON_VERSION=3.8
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading