-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Filter only ".dcm" files when reading DICOM series #6627
Comments
Hi @function2-llx , thanks for the suggestion, but I have seen some scanners exporting DICOM without the ".dcm" suffix, e.g. "IM_0001" on some ultrasound systems. It may be better to keep it optional. |
@mingxin-zheng Yes, maybe we can let the user decide whether to filter and what suffix to filter. |
I tagged this as a feature request and see if this is a generalized usage. Besides using the suffix to filter files, there are also many other possible name filters users want to customize. I am not sure whether a filter on suffix or something more general is needed. For now, as I see the MONAI/monai/data/image_reader.py Line 441 in 2cbed6c
import monai
import glob
files = glob.glob("dcm/*.DCM")
imgs = monai.data.PydicomReader().read(p) If we go for a filter later, maybe we can allow a regex pattern here for file inclusion/exclusion in the pydicom reader. MONAI/monai/data/image_reader.py Line 470 in 2cbed6c
|
Thanks, I feel like using a regex pattern is a good idea. On the other hand, reading a list of files may not work as expected because they will be stacked along the channel dimension (even permutation after that is not feasible since the affine compatibility check will fail). MONAI/monai/data/image_reader.py Lines 443 to 444 in 2cbed6c
MONAI/monai/data/image_reader.py Lines 127 to 131 in 2cbed6c
|
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Fixes #6627 ### Description adding a `fname_regex` option to the pydicom reader ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Fixes Project-MONAI#6627 ### Description adding a `fname_regex` option to the pydicom reader ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <wenqil@nvidia.com> Signed-off-by: Mark Graham <markgraham539@gmail.com>
Fixes Project-MONAI#6627 ### Description adding a `fname_regex` option to the pydicom reader ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Wenqi Li <wenqil@nvidia.com> Signed-off-by: Yu0610 <612410030@alum.ccu.edu.tw>
Is your feature request related to a problem? Please describe.
When I try to load a DICOM folder, the loading will fail if there is some irrelevant file in the folder (or I have to set
force=True
). E.g., when I load the DICOM series from the LIDC-IDRI database, there's a.xml
annotation file in the folder, the loader will try to load it as well and cause failure.Describe the solution you'd like
Change this line
MONAI/monai/data/image_reader.py
Line 469 in 2cbed6c
to something like
I'm not sure if there are other suffixes to be considered.
The text was updated successfully, but these errors were encountered: