void addInfo(int tag, int value) throws IOException { addInfo(tag, Integer.toString(value)); }
String key = i2hex(tag); case FD: if (elementLength==8) value = Double.toString(getDouble()); else for (int i=0; i<elementLength; i++) getByte(); break; case FL: if (elementLength==4) value = Float.toString(getFloat()); else for (int i=0; i<elementLength; i++) getByte(); break; value = getString(elementLength); break; case UN: value = getUNString(elementLength); break; case US: if (elementLength==2) value = Integer.toString(getShort()); else { int n = elementLength/2; StringBuilder sb = new StringBuilder(); for (int i=0; i<n; i++) { sb.append(Integer.toString(getShort())); sb.append(" ");
bytes[i] = getByte(); if (!getString(4).equals(DICM)) { if (!((bytes[0]==8||bytes[0]==2) && bytes[1]==0 && bytes[3]==0)) throw new IOException("This is not a DICOM or ACR/NEMA file"); int tag = getNextTag(); if ((location&1)!=0) // DICOM tags must be at even locations oddLocations = true; if (inSequence) { addInfo(tag, null); continue; switch (tag) { case TRANSFER_SYNTAX_UID: s = getString(elementLength); addInfo(tag, s); if (s.indexOf("1.2.4")>-1||s.indexOf("1.2.5")>-1) { f.close(); break; case MODALITY: modality = getString(elementLength); addInfo(tag, modality); break; case NUMBER_OF_FRAMES: s = getString(elementLength); addInfo(tag, s); double frames = s2d(s);
if (fileName==null) return; DicomDecoder dd = new DicomDecoder(directory, fileName); dd.inputStream = inputStream; FileInfo fi = null; try { fi = dd.getFileInfo(); } catch (IOException e) { String msg = e.getMessage(); IJ.error("DICOM Reader", e.getClass().getName()+"\n \n"+msg); return; } else if (!dd.dicmFound()&&showErrors) { msg = "This does not appear to be a valid\n" + "DICOM file. It does not have the\n" info = dd.getDicomInfo(); return; setProcessor(fileName, imp.getProcessor()); setCalibration(imp.getCalibration()); setProperty("Info", dd.getDicomInfo());
void addInfo(int tag, String value) throws IOException { String info = getHeaderInfo(tag, value); if (inSequence && info!=null && vr!=SQ) info = ">" + info; if (info!=null && tag!=ITEM) { int group = tag>>>16; //if (group!=previousGroup && (previousInfo!=null&&previousInfo.indexOf("Sequence:")==-1)) // dicomInfo.append("\n"); previousGroup = group; previousInfo = info; dicomInfo.append(tag2hex(tag)+info+"\n"); } if (IJ.debugMode) { if (info==null) info = ""; vrLetters[0] = (byte)(vr >> 8); vrLetters[1] = (byte)(vr & 0xFF); String VR = new String(vrLetters); IJ.log("(" + tag2hex(tag) + VR + " " + elementLength + " bytes from " + (location-elementLength)+") " + info); } }
String key = i2hex(tag); case FD: if (elementLength==8) value = Double.toString(getDouble()); else for (int i=0; i<elementLength; i++) getByte(); break; case FL: if (elementLength==4) value = Float.toString(getFloat()); else for (int i=0; i<elementLength; i++) getByte(); break; value = getString(elementLength); break; case UN: value = getUNString(elementLength); break; case US: if (elementLength==2) value = Integer.toString(getShort()); else { int n = elementLength/2; StringBuilder sb = new StringBuilder(); for (int i=0; i<n; i++) { sb.append(Integer.toString(getShort())); sb.append(" ");
bytes[i] = getByte(); if (!getString(4).equals(DICM)) { if (!((bytes[0]==8||bytes[0]==2) && bytes[1]==0 && bytes[3]==0)) throw new IOException("This is not a DICOM or ACR/NEMA file"); int tag = getNextTag(); if ((location&1)!=0) // DICOM tags must be at even locations oddLocations = true; if (inSequence) { addInfo(tag, null); continue; switch (tag) { case TRANSFER_SYNTAX_UID: s = getString(elementLength); addInfo(tag, s); if (s.indexOf("1.2.4")>-1||s.indexOf("1.2.5")>-1) { f.close(); break; case MODALITY: modality = getString(elementLength); addInfo(tag, modality); break; case NUMBER_OF_FRAMES: s = getString(elementLength); addInfo(tag, s); double frames = s2d(s);
if (fileName==null) return; DicomDecoder dd = new DicomDecoder(directory, fileName); dd.inputStream = inputStream; FileInfo fi = null; try { fi = dd.getFileInfo(); } catch (IOException e) { String msg = e.getMessage(); IJ.error("DICOM Reader", e.getClass().getName()+"\n \n"+msg); return; } else if (!dd.dicmFound()&&showErrors) { msg = "This does not appear to be a valid\n" + "DICOM file. It does not have the\n" info = dd.getDicomInfo(); return; setProcessor(fileName, imp.getProcessor()); setCalibration(imp.getCalibration()); setProperty("Info", dd.getDicomInfo());
void addInfo(int tag, String value) throws IOException { String info = getHeaderInfo(tag, value); if (inSequence && info!=null && vr!=SQ) info = ">" + info; if (info!=null && tag!=ITEM) { int group = tag>>>16; //if (group!=previousGroup && (previousInfo!=null&&previousInfo.indexOf("Sequence:")==-1)) // dicomInfo.append("\n"); previousGroup = group; previousInfo = info; dicomInfo.append(tag2hex(tag)+info+"\n"); } if (IJ.debugMode) { if (info==null) info = ""; vrLetters[0] = (byte)(vr >> 8); vrLetters[1] = (byte)(vr & 0xFF); String VR = new String(vrLetters); IJ.log("(" + tag2hex(tag) + VR + " " + elementLength + " bytes from " + (location-elementLength)+") " + info); } }
void addInfo(int tag, int value) throws IOException { addInfo(tag, Integer.toString(value)); }