Closed Ouwen closed 3 years ago
This might be another option: https://github.com/dcmjs-org/dcmjs/pull/134
Yes, I think I like the more general stopAfterTag
and untilTag
. PixelData
is almost always the last tag, but in case it isn't is there a case for skipping past it?
I like the #134 API using untilTag
for arbitrary tags.
The main use case I have is for users performing partial read of a dicom file over network. A 5kb request will likely read the DICOM metadata header and part of the pixel data. If no pixel data is found more bytes can be requested until some max size or the end of the file. In this case the pixel data byte stream will be cut at some arbitrary length. We would simply want to check for pixelDataTag existence as a stop, without needing to read the values.
In an ideal world, DICOM would have a metadata tag that points to when metadata bytes end. I'm not a dicom expert so I'm not sure if such a tag exists.
The two features for the network partial read use case would require the following:
untilTag
option is triggeredRegarding 2. I think the readTag
function would have to be intercepted to avoid doing work below:
https://github.com/dcmjs-org/dcmjs/blob/b17ea9ab8205590d24f55374cf16dcd43c0b7f40/src/DicomMessage.js#L139-L197
That sounds like a reasonable scenario. Do you think you could integrate that with https://github.com/dcmjs-org/dcmjs/pull/149 to handle that use case?
Sure happy to help make a PR. Regarding #149, we could add an ignoreValue
option in addition to the untilTag
. Then the flag will be existence of the untilTag in the dicom dict.
Closing due to #134 thanks @whatwilliam @pieper
In some situations the user may be only interested in the metadata from a dicom and would like to ignore the values from a pixel data tag.