-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add initial support for the DICOM format #21385
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
Open
kostrykin
wants to merge
45
commits into
galaxyproject:dev
Choose a base branch
from
kostrykin:feat/dicom
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
3cfd2cb
Add `Dicom` datatype and sniffer to datatypes_conf.xml.sample
kostrykin 24acfd2
Add dicom format, example file
hexylena 9d526a2
Implement `Dicom.set_meta`
kostrykin b741270
Fix formatting
kostrykin 1f1edb0
Extend and fix `Dicom.set_meta`
kostrykin 1984b52
Add test for `Dicom` metadata
kostrykin e941b08
Employ `pydicom` to identify DICOM files
kostrykin edb798c
Fix `Dicom.set_meta`
kostrykin 0adfb90
Add pydicom dependency
kostrykin be6bdcd
Fix images.py
kostrykin c82854c
Make `import pydicom` optional
kostrykin 72d39a0
Add `mimetype` and set `display_in_upload` to true for `Dicom`
kostrykin ddba90d
Add `description_url` for `Dicom`
kostrykin 6045517
Fix `Dicom` and tests
kostrykin 88b9906
Employ `build_sniff_from_prefix` and add test
kostrykin 481ede4
Restrict pydicom to Python >=3.10 in pyproject.toml
kostrykin 3b96806
Update deps with `lib/galaxy/dependencies/update.sh -p pydicom`
kostrykin df96139
Fix linting
kostrykin dcf5683
Fix reference to TotalPixelMatrix in images.py
kostrykin 3ff63e7
Revert 3b96806556737039d7998c0271d2d534b81ad603 for unrelated packages
kostrykin 602d0ba
Fix linting
kostrykin a56aee3
Fix linting
kostrykin 270643a
Fix linting
kostrykin bdfb096
Fix linting (now for real)
kostrykin 2758853
Add `pydicom` as a package dependency
kostrykin 3e28990
Fix bug in `Dicom.set_meta` that made integration tests fail
kostrykin 802a2aa
Employ more diverse DICOM test data
kostrykin 0272751
Migrate tests to new test data and fix `Dicom.set_meta`
kostrykin 9f15412
Fix tests and `Dicom.set_meta` implementation for tiled data
kostrykin 7e23152
Add `is_tiled` metadata element for DICOM
kostrykin 2dd31e9
Refactor test/unit/data/datatypes/test_images.py
kostrykin 6a21206
Refactor test/unit/data/datatypes/test_images.py
kostrykin 0188ab9
Fix type hints
kostrykin 8d1247b
Fix linting
kostrykin a1c28d9
Adopt formatting for black to pass
kostrykin 93724f0
Revert import order to what isort likes but flake8 doesn't
kostrykin df5fe20
Fix docstring example
kostrykin b4a8d6c
Reproduce bug (integration test failure) as unit test
kostrykin 5515f18
Employ `build_sniff_from_prefix` for `Tiff` to solve ambiguity with `…
kostrykin dc7ba53
Bring back `channels` metadata element (deleted by accident)
kostrykin ab12b60
Fix formatting for black
kostrykin 177f9b5
Clean up `OMETiff.sniff` and add tests
kostrykin d8375ee
Fix formatting for black
kostrykin aa17319
Ignore `sniff_prefix` in `OMETiff` derived from `Tiff`
kostrykin ea5eff3
Revert aa1731941eaba07b1028b266ca11075d280a4879 for sniff.py, reimple…
kostrykin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../test-data/highdicom/ct_image.dcm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../test-data/highdicom/seg_image_ct_binary.dcm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../test-data/highdicom/sm_image.dcm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Copyright 2020 MGH Computational Pathology | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a feeling this won't work for larger files where the image is larger than the
contents_header_bytes.Maybe you can use the
@disable_parent_class_sniffingdecorator fromlib/galaxy/datatypes/sniff.pyand restore the previoussniffmethod?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it (see kostrykin#4), but when I put the
@disable_parent_class_sniffingdecorator on theOMETiffclass, thesniffmethod does not get called. The decorator seems to disable sniffing.The
test/unit/data/datatypes/test_images.py::test_ome_tiff_snifffails withDespite that
OMETiff.sniffis implemented asthus,
OMETiff.sniffis not called when the@disable_parent_class_sniffingdecorator is in place.Here is the error from running the test: https://github.com/kostrykin/galaxy/actions/runs/19942920690/job/57185121231?pr=4#step:8:11238
That said, I think the current solution should work, because
tifffile.TiffFileonly reads the headers/metadata of the file. The pixel content only is read when the corresponding methods are used (they are not used here).On the other hand, since we do not know how large metadata can be, or how it is organized, if there is a possibility to get this working without
sniff_prefix, I'd go for that.