Loading ...
Sorry, an error occurred while loading the content.

Catch AttributeList.read error

Expand Messages
  • rogerdelaforet
    Hello, I try to read Dicom information (like patientName) in Dicom files list. When the file RD is bad, there is an error : AttributeList.read():
    Message 1 of 5 , Mar 14, 2012
    View Source
    • 0 Attachment
      Hello,

      I try to read Dicom information (like patientName) in Dicom files list.

      When the file RD is bad, there is an error :

      "AttributeList.read(): (0x322d,0x315c) encountered incorrect Implicit VR Element encoding in Explicit VR Transfer Syntax ... compensating
      com.pixelmed.dicom.DicomException: Could not instantiate an attribute for (0x322d,0x315c): java.lang.OutOfMemoryError: Java heap space"

      I want to ignore this file, display a beautiful message and go to the next.

      But i can't catch this exception.

      How I can ignore this file ?

      Thank you
    • wwsw3
      Hi, It is hard to say for sure without having the file, but it sounds like the data may be malformed. If the data is, in fact, encoded as Implicit VR, but
      Message 2 of 5 , Mar 16, 2012
      View Source
      • 0 Attachment
        Hi,

        It is hard to say for sure without having the file, but it sounds like the data may be malformed. If the data is, in fact, encoded as Implicit VR, but AttributeList believes it found a VR somewhere, it is likely that the parsing went awry...perhaps resulting in a very large and erroneous value length which could have led to the memory issue. The group, element (322d,315c) would be a private tag, but is a bit unusual. What manufacturer and modality generated the data?

        Have you tried using the other read method which allows you to specify an attribute as a stopping point. Like:

        read(File file, AttributeTag stopAtTag)

        You could try reading up to the PatientName attribute and see if that bypasses the error.

        Also, you tried and couldn't catch the DicomError?

        -Scott

        --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@...> wrote:
        >
        > Hello,
        >
        > I try to read Dicom information (like patientName) in Dicom files list.
        >
        > When the file RD is bad, there is an error :
        >
        > "AttributeList.read(): (0x322d,0x315c) encountered incorrect Implicit VR Element encoding in Explicit VR Transfer Syntax ... compensating
        > com.pixelmed.dicom.DicomException: Could not instantiate an attribute for (0x322d,0x315c): java.lang.OutOfMemoryError: Java heap space"
        >
        > I want to ignore this file, display a beautiful message and go to the next.
        >
        > But i can't catch this exception.
        >
        > How I can ignore this file ?
        >
        > Thank you
        >
      • rogerdelaforet
        Hi, The problem is what you say (implicit VR) try { AttributeList attributeList=new AttributeList(); attributeList.read(file); } catch (IOException ex) {
        Message 3 of 5 , Mar 20, 2012
        View Source
        • 0 Attachment
          Hi,

          The problem is what you say (implicit VR)

          try {
          AttributeList attributeList=new AttributeList();
          attributeList.read(file);
          } catch (IOException ex) {
          System.err.println("Can't read file "+file.getName());
          } catch (DicomException ex) {
          System.err.println("Error while reading file "+file.getName());
          }

          This code not enter in catch. But error (my first message) is printing in console

          --- In pixelmed_dicom@yahoogroups.com, "wwsw3" <whitews@...> wrote:
          >
          > Hi,
          >
          > It is hard to say for sure without having the file, but it sounds like the data may be malformed. If the data is, in fact, encoded as Implicit VR, but AttributeList believes it found a VR somewhere, it is likely that the parsing went awry...perhaps resulting in a very large and erroneous value length which could have led to the memory issue. The group, element (322d,315c) would be a private tag, but is a bit unusual. What manufacturer and modality generated the data?
          >
          > Have you tried using the other read method which allows you to specify an attribute as a stopping point. Like:
          >
          > read(File file, AttributeTag stopAtTag)
          >
          > You could try reading up to the PatientName attribute and see if that bypasses the error.
          >
          > Also, you tried and couldn't catch the DicomError?
          >
          > -Scott
          >
          > --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@> wrote:
          > >
          > > Hello,
          > >
          > > I try to read Dicom information (like patientName) in Dicom files list.
          > >
          > > When the file RD is bad, there is an error :
          > >
          > > "AttributeList.read(): (0x322d,0x315c) encountered incorrect Implicit VR Element encoding in Explicit VR Transfer Syntax ... compensating
          > > com.pixelmed.dicom.DicomException: Could not instantiate an attribute for (0x322d,0x315c): java.lang.OutOfMemoryError: Java heap space"
          > >
          > > I want to ignore this file, display a beautiful message and go to the next.
          > >
          > > But i can't catch this exception.
          > >
          > > How I can ignore this file ?
          > >
          > > Thank you
          > >
          >
        • rogerdelaforet
          And I can t specify an attribute to stop reading, because I want to write on my DICOM file, so I must read all the file. (sorry for my wonderful english)
          Message 4 of 5 , Mar 20, 2012
          View Source
          • 0 Attachment
            And I can't specify an attribute to stop reading, because I want to write on my DICOM file, so I must read all the file.


            (sorry for my wonderful english)

            --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@...> wrote:
            >
            > Hi,
            >
            > The problem is what you say (implicit VR)
            >
            > try {
            > AttributeList attributeList=new AttributeList();
            > attributeList.read(file);
            > } catch (IOException ex) {
            > System.err.println("Can't read file "+file.getName());
            > } catch (DicomException ex) {
            > System.err.println("Error while reading file "+file.getName());
            > }
            >
            > This code not enter in catch. But error (my first message) is printing in console
            >
            > --- In pixelmed_dicom@yahoogroups.com, "wwsw3" <whitews@> wrote:
            > >
            > > Hi,
            > >
            > > It is hard to say for sure without having the file, but it sounds like the data may be malformed. If the data is, in fact, encoded as Implicit VR, but AttributeList believes it found a VR somewhere, it is likely that the parsing went awry...perhaps resulting in a very large and erroneous value length which could have led to the memory issue. The group, element (322d,315c) would be a private tag, but is a bit unusual. What manufacturer and modality generated the data?
            > >
            > > Have you tried using the other read method which allows you to specify an attribute as a stopping point. Like:
            > >
            > > read(File file, AttributeTag stopAtTag)
            > >
            > > You could try reading up to the PatientName attribute and see if that bypasses the error.
            > >
            > > Also, you tried and couldn't catch the DicomError?
            > >
            > > -Scott
            > >
            > > --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@> wrote:
            > > >
            > > > Hello,
            > > >
            > > > I try to read Dicom information (like patientName) in Dicom files list.
            > > >
            > > > When the file RD is bad, there is an error :
            > > >
            > > > "AttributeList.read(): (0x322d,0x315c) encountered incorrect Implicit VR Element encoding in Explicit VR Transfer Syntax ... compensating
            > > > com.pixelmed.dicom.DicomException: Could not instantiate an attribute for (0x322d,0x315c): java.lang.OutOfMemoryError: Java heap space"
            > > >
            > > > I want to ignore this file, display a beautiful message and go to the next.
            > > >
            > > > But i can't catch this exception.
            > > >
            > > > How I can ignore this file ?
            > > >
            > > > Thank you
            > > >
            > >
            >
          • dclunie99
            Hi Roger This sort of thing is indeed usually caused by reading a non-DICOM file, and trying to allocate an excessively large amount of memory for an
            Message 5 of 5 , Apr 8 11:48 AM
            View Source
            • 0 Attachment
              Hi Roger

              This sort of thing is indeed usually caused by reading a non-DICOM file, and trying to allocate an excessively large amount of memory for an unrecognized data element treated as having an unknown VR.

              I have added some sanity checks on the VL that should throw a more easily caught exception rather than continuing to try until running out of memory (and potentially making the application unstable). See the 20120408_experimental pixelmed.jar file on the web site, and let me know if it works for you.

              Since this is pretty fundamental, I want to do a whole lot more regression testing on genuine DICOM files with very large attributes before I include this in the main release and break something. I.e., I don't want it breaking on genuine files, and there are a number of special cases to consider.

              David

              --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@...> wrote:
              >
              > And I can't specify an attribute to stop reading, because I want to write on my DICOM file, so I must read all the file.
              >
              >
              > (sorry for my wonderful english)
              >
              > --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@> wrote:
              > >
              > > Hi,
              > >
              > > The problem is what you say (implicit VR)
              > >
              > > try {
              > > AttributeList attributeList=new AttributeList();
              > > attributeList.read(file);
              > > } catch (IOException ex) {
              > > System.err.println("Can't read file "+file.getName());
              > > } catch (DicomException ex) {
              > > System.err.println("Error while reading file "+file.getName());
              > > }
              > >
              > > This code not enter in catch. But error (my first message) is printing in console
              > >
              > > --- In pixelmed_dicom@yahoogroups.com, "wwsw3" <whitews@> wrote:
              > > >
              > > > Hi,
              > > >
              > > > It is hard to say for sure without having the file, but it sounds like the data may be malformed. If the data is, in fact, encoded as Implicit VR, but AttributeList believes it found a VR somewhere, it is likely that the parsing went awry...perhaps resulting in a very large and erroneous value length which could have led to the memory issue. The group, element (322d,315c) would be a private tag, but is a bit unusual. What manufacturer and modality generated the data?
              > > >
              > > > Have you tried using the other read method which allows you to specify an attribute as a stopping point. Like:
              > > >
              > > > read(File file, AttributeTag stopAtTag)
              > > >
              > > > You could try reading up to the PatientName attribute and see if that bypasses the error.
              > > >
              > > > Also, you tried and couldn't catch the DicomError?
              > > >
              > > > -Scott
              > > >
              > > > --- In pixelmed_dicom@yahoogroups.com, "rogerdelaforet" <rogerdelaforet@> wrote:
              > > > >
              > > > > Hello,
              > > > >
              > > > > I try to read Dicom information (like patientName) in Dicom files list.
              > > > >
              > > > > When the file RD is bad, there is an error :
              > > > >
              > > > > "AttributeList.read(): (0x322d,0x315c) encountered incorrect Implicit VR Element encoding in Explicit VR Transfer Syntax ... compensating
              > > > > com.pixelmed.dicom.DicomException: Could not instantiate an attribute for (0x322d,0x315c): java.lang.OutOfMemoryError: Java heap space"
              > > > >
              > > > > I want to ignore this file, display a beautiful message and go to the next.
              > > > >
              > > > > But i can't catch this exception.
              > > > >
              > > > > How I can ignore this file ?
              > > > >
              > > > > Thank you
              > > > >
              > > >
              > >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.