thanili
thanili

Reputation: 617

Read private dicom TAGS from various vendors - dcm4che2

I am wondering on which is the most efficient way to setup & build a JAVA application (using dcm4che2 toolkit) for being able to indentify and parse in a proper way DICOMs from various vendors.

For example at the moment i need to parse private tags from MRIs manufactured by Siemens, GE and Philips. I can see that even for the same vendor there are differences in the VR of the same private tags.

At the moment i am trying to parse these private TAGs by using code as the one listed below:

//get acquisitionMatrixX of a DICOM file
public String getAcquisitionMatrixX(File file) throws IOException {

    String acquisitionMatrixX =null;
    String manufacturer = null;

    CheckIfIsDicom checkFile = new CheckIfIsDicom();

    if(checkFile.checkIfDicomObjectFileB(file)) {
        try {

            DicomObject dcmObj4;
            DicomInputStream din4 = null;
            din4 = new DicomInputStream(file);
            dcmObj4 = din4.readDicomObject();

            manufacturer = dcmObj4.getString(Tag.Manufacturer);

            if(manufacturer.contains("GE")) {                    
                acquisitionMatrixX = dcmObj4.getString(0X00181310, VR.US);
                log.info("GE machine |acquisitionMatrixX| --------- Value for tag: " + acquisitionMatrixX);
            } else if (manufacturer.contains("SIEMENS")) {
                //IN CASE OF some models VR.SH & UN
                acquisitionMatrixX = dcmObj4.getString(0X0051100b, VR.LO);
                log.info("SIEMENS machine |acquisitionMatrixX| --------- Value for tag: " + acquisitionMatrixX);
            } else if (manufacturer.toLowerCase().contains("PHILIPS".toLowerCase())) {
                acquisitionMatrixX = dcmObj4.getString(0X00189058, VR.US);
                log.info("PHILIPS machine |acquisitionMatrixX| --------- Value for tag: " + acquisitionMatrixX);
            } else {
                acquisitionMatrixX = "";
            }

            din4.close(); 
        }
        catch (IOException e) {
                e.printStackTrace();
        } finally {
            if("".equals(acquisitionMatrixX) || acquisitionMatrixX==null) {
                acquisitionMatrixX="-100000";
            } else {
            }
        }
    } else {
        log.info("### IS NOT DICOM! ####");
        log.info("Selected file is not a DICOM Object");
    }

    return acquisitionMatrixX;
}

However i do not think that such a way of parsing DICOM tags from different vendors is the most efficient in terms of consistency and maintenance of code/logic!

For example in many cases there is a different VR among different models of the same vendor.

Does anybody has developed an application with such a requirement? Are there any other ways to try and automate this process (e.g. by using data dictionaries per vendor/model?)

Anybody has some rough propositions or guideliness on that?

Thanks!

Upvotes: 0

Views: 1637

Answers (1)

cneller
cneller

Reputation: 1582

If you've added the private tags to your dictionary (see http://www.dcm4che.org/confluence/display/d2/Adding+private+tags+to+the+dictionary), you should be able to do something like the following to get the acquisition matrix:

short[] acq = dcmObj4.getShorts( Tag.AcquisitionMatrix, null );
if( null == acq ) {
  // Try Siemens Private Attribute
  int tagTest = dcmObj4.resolveTag( PrivateTag.SiemensAcquistionMatrix, dcmObj4.getPrivateCreator( PrivateTag.SiemensAcquistionMatrix) );
  if( tagTest == PrivateTag.SiemensAcquisitionMatrix ) {
    acq = dcmObj4.getShorts( PrivateTag.SiemensAcquistionMatrix, null );
    break;
  }
  // Try Philips Private Attribute
  :
}
return acq;

Above, I've assumed a PrivateTag class that holds the appropriate attribute values. Also, check your tags - does Philips really keep the x value of the acquisition matrix in the DICOM attribute MR Acquisition Frequency Encoding Steps?

Upvotes: 1

Related Questions