Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PydicomReader dimension mismatch vs. pydicom #8265

Closed
oseymour opened this issue Dec 18, 2024 · 1 comment
Closed

PydicomReader dimension mismatch vs. pydicom #8265

oseymour opened this issue Dec 18, 2024 · 1 comment

Comments

@oseymour
Copy link

oseymour commented Dec 18, 2024

Describe the bug
I get different dimensions when loading with the LoadImage transform and pydicom, even when specifying reader="PydicomReader". The DICOM file is a multi-frame ultrasound file. Unfortunately, I can't share it here because this is for work.

To Reproduce
Running pydicom.dcmread(path_to_file).shape returns (61, 748, 982, 3). This is the expected result.

Running LoadImage(image_only=True, reader="PydicomReader").shape returns torch.Size([748, 61, 982, 3]). I see the same behavior without specifying reader.

Expected behavior
The arrays should have the same dimensions.

Screenshots
N/A

Environment

Ensuring you use the relevant python executable, please paste the output of:

================================
Printing MONAI config...
================================
MONAI version: 1.4.0
Numpy version: 1.26.4
Pytorch version: 2.5.1+cpu
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: 46a5272196a6c2590ca2589029eed8e4d56ff008
MONAI __file__: C:\Users\<username>.HCAD\Downloads\carotid_multiframe_model\.venv\Lib\site-packages\monai\__init__.py

Optional dependencies:
Pytorch Ignite version: NOT INSTALLED or UNKNOWN VERSION.
ITK version: NOT INSTALLED or UNKNOWN VERSION.
Nibabel version: 5.3.2
scikit-image version: NOT INSTALLED or UNKNOWN VERSION.
scipy version: NOT INSTALLED or UNKNOWN VERSION.
Pillow version: 11.0.0
Tensorboard version: 2.18.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: NOT INSTALLED or UNKNOWN VERSION.
tqdm version: 4.67.1
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 6.1.0
pandas version: NOT INSTALLED or UNKNOWN VERSION.
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.
clearml 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: Windows
Win32 version: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Win32 edition: Enterprise
Platform: Windows-10-10.0.19045-SP0
Processor: Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
Machine: AMD64
Python version: 3.12.3
Process name: python.exe
Command: ['C:\\Users\\<username>.HCAD\\AppData\\Local\\Programs\\Python\\Python312\\python.exe', '-c', 'import monai; monai.config.print_debug_info()']
Open files: [popenfile(path='C:\\Windows\\System32\\en-US\\KernelBase.dll.mui', fd=-1)]
Num physical CPUs: 10
Num logical CPUs: 12
Num usable CPUs: 12
CPU usage (%): [45.3, 3.3, 55.0, 0.0, 2.7, 2.0, 2.0, 12.7, 8.0, 1.3, 3.3, 6.7]
CPU freq. (MHz): 1800
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 76.7
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 31.4
Available memory (GB): 17.4
Used memory (GB): 14.0

================================
Printing GPU config...
================================
Num GPUs: 0
Has CUDA: False
cuDNN enabled: False
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None

And since it's not printed out above, the pydicom version I'm using is 3.0.1.

Additional context
Add any other context about the problem here.

@KumoLiu
Copy link
Contributor

KumoLiu commented Dec 19, 2024

Hi @oseymour, thanks for reporting this.
You can set swap_ij=False in the LoadImage function. By default, this value is set to True to ensure the outputs are consistent with other readers.

swap_ij: whether to swap the first two spatial axes. Default to ``True``, so that the outputs

@Project-MONAI Project-MONAI locked and limited conversation to collaborators Dec 19, 2024
@KumoLiu KumoLiu converted this issue into discussion #8266 Dec 19, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants