Returns the string value from the "Info" property string associated with 'key', or null if the key is not found. Works with DICOM tags and Bio-Formats metadata. @see #getNumericProperty @see #getInfoProperty @see #getProp @see #setProp
(String key)
| 1549 | * @see #setProp |
| 1550 | */ |
| 1551 | public String getStringProperty(String key) { |
| 1552 | if (key==null) |
| 1553 | return null; |
| 1554 | if (isDicomTag(key)) |
| 1555 | return DicomTools.getTag(this, key); |
| 1556 | if (getStackSize()>1) { |
| 1557 | ImageStack stack2 = getStack(); |
| 1558 | String label = stack2.getSliceLabel(getCurrentSlice()); |
| 1559 | if (label!=null && label.indexOf('\n')>0) { |
| 1560 | String value = getStringProperty(key, label); |
| 1561 | if (value!=null) |
| 1562 | return value; |
| 1563 | } |
| 1564 | } |
| 1565 | Object obj = getProperty("Info"); |
| 1566 | if (obj==null || !(obj instanceof String)) |
| 1567 | return null; |
| 1568 | String info = (String)obj; |
| 1569 | return getStringProperty(key, info); |
| 1570 | } |
| 1571 | |
| 1572 | private boolean isDicomTag(String key) { |
| 1573 | if (key.length()!=9 || key.charAt(4)!=',') |
no test coverage detected