Actions
Bug #888
closedstorescp fails parsing UN VR sequence items
Start date:
2019-06-24
Due date:
% Done:
100%
Estimated time:
Module:
dcmdata
Operating System:
Compiler:
Description
How to reproduce:
- Run a storescp configured to convert VR=UN encoded attributes to real VR.
- Send a Implicit VR Little Endian encoded image that contains a VR=UN sequence of a known attribute.
- The storescp will fail to receive the image with error messages indicating that it encountered an unknown VR.
- Interestingly dcmconv doesn't display the same issue
Patch to enable recover-VR for storescp:
--- a/dcmnet/apps/storescp.cc
+++ b/dcmnet/apps/storescp.cc
@@ -342,7 +342,10 @@ int main(int argc, char *argv[])
cmd.addSubGroup("data set trailing padding (not with --write-dataset or --bit-preserving):");
cmd.addOption("--padding-off", "-p", "no padding (default)");
cmd.addOption("--padding-create", "+p", 2, "[f]ile-pad [i]tem-pad: integer",
- "align file on multiple of f bytes and items\non multiple of i bytes");
+ "align file on multiple of f bytes and items\non multiple of i bytes");
+ cmd.addSubGroup("handling of defined length UN elements:");
+ cmd.addOption("--retain-un", "-uc", "retain elements as UN (default)");
+ cmd.addOption("--convert-un", "+uc", "convert to real VR if known");
#ifdef WITH_ZLIB
cmd.addSubGroup("deflate compression level (only with --write-xfer-deflated/same):");
cmd.addOption("--compression-level", "+cl", 1, "[l]evel: integer (default: 6)",
@@ -789,6 +792,17 @@ int main(int argc, char *argv[])
}
cmd.endOptionBlock();
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--retain-un"))
+ {
+ dcmEnableUnknownVRConversion.set(OFFalse);
+ }
+ if (cmd.findOption("--convert-un"))
+ {
+ dcmEnableUnknownVRConversion.set(OFTrue);
+ }
+ cmd.endOptionBlock();
+
#ifdef WITH_ZLIB
if (cmd.findOption("--compression-level"))
{
A patch that seems to fix the bug:
--- a/dcmdata/libsrc/dcitem.cc
+++ b/dcmdata/libsrc/dcitem.cc
@@ -4306,7 +4306,7 @@ OFCondition DcmItem::newDicomElement(DcmElement *&newElement,
// sequences and items:
case EVR_SQ :
- newElement = new DcmSequenceOfItems(tag, length);
+ newElement = new DcmSequenceOfItems(tag, length, readAsUN);
break;
case EVR_na :
if (tag.getXTag() == DCM_Item)
Reported 2019-06-21 by Jesper Bojesen <jbojesen@vitalimages.com>
Files
Actions