-
Notifications
You must be signed in to change notification settings - Fork 78
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
Data set level reading and writing of encapsulated pixel data #42
Merged
Conversation
This file contains 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
- extend stateful encoder/decoded to read/write raw bytes - new data token type ItemValue - add method `Header.is_encapsulated_pixeldata` - on pixeldata element with undefined length, treat data as encapsulated
replaces DataElementHeader with encapsulated pixel data check
- @ DataSetWriter, treat encapsulated element start as a new sequence
- at DataSetReader, discard last pixel data header on first read to prevent reentrance - also test behavior on DataSetWriter
to PixelSequenceStart, simpler and possibly more familiar
- implement pixel sequence reading so that all fragments are joined together in a single vector
- new type parameter P in value::Value and dependents - for representing Pixel information - new variant PixelSequence in value::Value - into_tokens algorithms adjusted accordingly to produce pixel sequence tokens - ItemValue impl for tokens of a single item with raw data - InMemDicomObject now contains pixel sequence items on encapsulated pixel data - add test for reading encapsulated pixel data with non-empty offset table
- adjust output width and spacing calculation - write sequence delimitation item - write pixel sequence items - use DICOM conventional byte printing format
- ensure that the following items are stored as compressed fragments at the end of the first one
- generalize methods for taking iterators of `Result<DataToken>` instead of data set readers explicitly - easier to test - add tests on turning tokens into in-mem objects
clippy::into_iter_on_ref
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR extends the data set reader/writer so that it understands the logic of pixel sequences in the data set. This ultimately makes it possible to read files with an encapsulated pixel data. Resolves #23.
DataToken
s:PixelSequenceStart
(for the beginning of an encapsulated pixel data element) andItemValue
(for the raw contents of a pixel data item).InMemDicomObject
will collect all fragments and the offset table as-is into memory, thus retaining the fact that the pixel data is encapsulated.The known caveat is that DICOM values and data tokens need to own the memory that they are working with. This means that data may still need to be copied around in some cases (e.g. saving a DICOM object to disk), and that each data token has to be fully contained in memory. This is likely to be reiterated to address the concerns presented in #1, so that tokens may instead borrow or refer to an arbitrary reader source.