My question is quite simple: How can i read a private dicom TAG (e.g. 0019,105A) ny using the dcm4che2 toolkit?
I am able to parse/read "public" dicom tags by using:
try {
DicomObject dcmObj5;
DicomInputStream din5 = null;
din5 = new DicomInputStream(file);
dcmObj5 = din5.readDicomObject();
tmpSeriesId = dcmObj5.getString(Tag.SeriesInstanceUID);
din5.close();
}
catch (IOException e) {
e.printStackTrace();
}
Can i use somehow getString() to read a private dicom tag?
tmpSeriesId = dcmObj5.getString(0x00020010);
try { DicomObject dcmObj5; DicomInputStream din5 = null; din5 = new DicomInputStream(file); dcmObj5 = din5.readDicomObject(); tmpSeriesId = dcmObj5.getString(0x00020010); din5.close(); } catch (IOException e) { e.printStackTrace(); }
DicomObject dcm = readDicomObject(input);
String
0019,105A");
tmpSeriesId = getHeaderStringValue("
My codes :
/**
* Read the file into a dicom object
* @param f the dicom file
* @return the read dicom object
*/
public static DicomObject readDicomObject(File f) {
DicomObject dcmObj;
DicomInputStream din = null;
try {
din = new DicomInputStream(f);
dcmObj = din.readDicomObject();
return dcmObj;
}
catch (IOException e) {
e.printStackTrace();
return null;
}
finally {
try {
din.close();
}
catch (IOException ignore) {
}
}
}
/**
*reads the tag (group,element)
* @param headerNr e.g. "0018,0050" to get Slice Thickness<br>
* @return String
* @throws DicomHeaderParseException
*/
public String getHeaderStringValue(String headerNr) {
headerNr = headerNr.replaceAll("xx", "00").replaceAll("XX", "00");
return getHeaderStringValue(toTagInt(headerNr));
}
/**
* Converts the string representation of a header number
* e.g. 0008,0010 to the corresponding integer as 0x00080010
* as used in the @see org.dcm4che2.data.Tag
* @param headerNr e.g. 0008,0010
* @return 0x00080010 as int
* @throws DicomHeaderParseException
*/
public static int toTagInt(String headerNr){
return Integer.parseInt(headerNr.replaceAll(",", ""), 16);
}