Spacing transform does not return affines
See original GitHub issueDescribe the bug
Calling an instance of Spacing
transform does not return the original and current affines. This is also seen in the source code linked in the docs. The expected return is a tuple (data_array, original affine, current affine), but only data_array
is returned.
To Reproduce
Call Spacing
transform on any valid input.
Expected behavior Return a tuple (data_array, original affine, current affine)
Environment
Ensuring you use the relevant python executable, please paste the output of:
================================
Printing MONAI config...
================================
MONAI version: 0.9.1
Numpy version: 1.22.3
Pytorch version: 1.11.0+cu102
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 356d2d2f41b473f588899d705bbc682308cee52c
MONAI __file__: package/venv/lib64/python3.8/site-packages/monai/__init__.py
Optional dependencies:
Pytorch Ignite version: NOT INSTALLED or UNKNOWN VERSION.
Nibabel version: 3.2.2
scikit-image version: 0.19.2
Pillow version: 9.1.0
Tensorboard version: 2.9.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: NOT INSTALLED or UNKNOWN VERSION.
tqdm version: 4.64.0
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.9.0
pandas version: 1.4.2
einops version: NOT INSTALLED or UNKNOWN VERSION.
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
pynrrd version: NOT INSTALLED or UNKNOWN VERSION.
For details about installing the optional dependencies, please visit:
https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
================================
Printing system config...
================================
System: Linux
Linux version: CentOS Linux 7 (Core)
Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.2.5
Processor: x86_64
Machine: x86_64
Python version: 3.8.11
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Num physical CPUs: 16
Num logical CPUs: 32
Num usable CPUs: 32
CPU usage (%): [19.8, 17.7, 26.3, 21.3, 17.1, 23.3, 10.9, 25.5, 66.9, 31.1, 39.6, 21.6, 36.7, 28.4, 43.3, 50.4, 2.9, 3.5, 4.5, 3.7, 2.8, 3.6, 3.7, 5.0, 5.7, 10.7, 7.8, 23.4, 7.8, 10.1, 7.4, 3.6]
CPU freq. (MHz): 2
Load avg. in last 1, 5, 15 mins (%): [70.4, 65.9, 49.4]
Disk usage (%): 91.5
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 187.6
Available memory (GB): 83.4
Used memory (GB): 103.2
================================
Printing GPU config...
================================
Num GPUs: 1
Has CUDA: True
CUDA version: 10.2
cuDNN enabled: True
cuDNN version: 7605
Current device: 0
Library compiled for CUDA architectures: ['sm_37', 'sm_50', 'sm_60', 'sm_70']
GPU 0 Name: Tesla V100-PCIE-32GB
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 80
GPU 0 Total memory (GB): 31.7
GPU 0 CUDA capability (maj.min): 7.0
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Affine transformation does not preserve normal vectors
An affine transform may not preserve orthogonality. For example, the points (0,0),(1,0),(0,1) form a right angle. By the transformation (x,y)→( ...
Read more >CropForegroundd does not adjust the affine accordingly #3167
We would expect that the affine is changed relative to the crop so that the cropped image still aligns in 3D space. This...
Read more >Affine transformation - Wikipedia
Unlike a purely linear transformation, an affine transformation need not preserve the origin of the affine space.
Read more >python - Padding scipy affine_transform output to show non ...
affine_transform to recover the dst -aligned src image. The problem is that, when the images are not fuly overlapping, the resultant image is ......
Read more >Transforms and Resampling
An affine transformation preserves convexity with extreme points mapped to extreme points.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, I see! I will try to update it.
Hi @KumoLiu, I think it’s more about the wrong documentation in the code, for example this line: https://github.com/Project-MONAI/MONAI/blob/483190953c5ec17832d798a9654cf5fa0b1ab1f7/monai/transforms/spatial/array.py#L511