Returns the value (as a string) of the specified DICOM tag id (in the form "0018,0050") of the specified image or stack slice. Returns null if the tag id is not found.
(ImagePlus imp, String id)
| 118 | /** Returns the value (as a string) of the specified DICOM tag id (in the form "0018,0050") |
| 119 | of the specified image or stack slice. Returns null if the tag id is not found. */ |
| 120 | public static String getTag(ImagePlus imp, String id) { |
| 121 | String metadata = null; |
| 122 | if (imp.getStackSize()>1) { |
| 123 | ImageStack stack = imp.getStack(); |
| 124 | String label = stack.getSliceLabel(imp.getCurrentSlice()); |
| 125 | if (label!=null && label.indexOf('\n')>0) metadata = label; |
| 126 | } |
| 127 | if (metadata==null) |
| 128 | metadata = (String)imp.getProperty("Info"); |
| 129 | return getTag(metadata, id); |
| 130 | } |
| 131 | |
| 132 | /** Returns the name of the specified DICOM tag id. */ |
| 133 | public static String getTagName(String id) { |
no test coverage detected