@Override public Object getValueAt(int rowIndex, int columnIndex) { TagW tag = tagsToDisplay()[rowIndex]; switch (columnIndex) { case 0: return tag; case 1: if (tagable.isPresent()) { return tagable.get().getTagValue(tag); } else { return null; } } return null; }
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex == 1) { TagW tag = tagsToDisplay()[rowIndex]; tagable.ifPresent(t -> { t.setTag(tag, aValue); fireTableCellUpdated(rowIndex, columnIndex); }); } }
public void readValue(Object data, Tagable tagable) { tagable.setTagNoNull(this, getValue(data)); }
tagable.setTagNoNull(TagW.ModalityLUTData, createLut(mLutItems)); tagable.setTagNoNull(TagW.ModalityLUTType, TagD.get(Tag.ModalityLUTType).getValue(mLutItems)); tagable.setTagNoNull(TagW.ModalityLUTExplanation, TagD.get(Tag.LUTExplanation).getValue(mLutItems)); if (tagable.getTagValue(TagW.ModalityLUTData) != null) { if (TagD.getTagValue(tagable, Tag.RescaleIntercept) != null) { LOGGER.trace("Modality LUT Sequence shall NOT be present if Rescale Intercept is present"); //$NON-NLS-1$
/** * @see <a href="http://dicom.nema.org/medical/Dicom/current/output/chtml/part03/sect_C.11.6.html">C.11.6 Softcopy * Presentation LUT Module</a> */ public static void applyPrLutModule(Attributes dcmItems, Tagable tagable) { if (dcmItems != null && tagable != null) { // TODO implement 1.2.840.10008.5.1.4.1.1.11.2 -5 color and xray if ("1.2.840.10008.5.1.4.1.1.11.1".equals(dcmItems.getString(Tag.SOPClassUID))) { //$NON-NLS-1$ Attributes presentationLUT = dcmItems.getNestedDataset(Tag.PresentationLUTSequence); if (presentationLUT != null) { /** * Presentation LUT Module is always implicitly specified to apply over the full range of output of * the preceding transformation, and it never selects a subset or superset of the that range (unlike * the VOI LUT). */ tagable.setTag(TagW.PRLUTsData, createLut(presentationLUT)); tagable.setTag(TagW.PRLUTsExplanation, getStringFromDicomElement(presentationLUT, Tag.LUTExplanation)); tagable.setTagNoNull(TagD.get(Tag.PresentationLUTShape), "IDENTITY"); //$NON-NLS-1$ } else { // value: INVERSE, IDENTITY // INVERSE => must inverse values (same as monochrome 1) TagD.get(Tag.PresentationLUTShape).readValue(dcmItems, tagable); } } } }
/** * Updates all Dicom Tags from the given document except Patient Dicom Group Tags * * @param xml */ public void updateAllButPatient(Tagable tagable) { if (tagable != null) { tagable.getTagEntrySetIterator().forEachRemaining(i -> { TagW tag = i.getKey(); if (tag != null && TagUtils.groupNumber(tag.getId()) != patientDicomGroupNumber) { tags.put(tag, i.getValue()); } }); } }
TagD.get(Tag.FrameContentSequence).readValue(data, tagable); tagable.setTagNoNull(TagD.get(Tag.InstanceNumber), tagable.getTagValue(TagD.get(Tag.InStackPositionNumber))); TagD.get(Tag.PlaneOrientationSequence).readValue(data, tagable); tagable.setTagNoNull(TagW.ImageOrientationPlane, ImageOrientation.makeImageOrientationLabelFromImageOrientationPatient( TagD.getTagValue(tagable, Tag.ImageOrientationPatient, double[].class)));
public boolean containsSameTagValues(Tagable tagable, Integer dicomGroupNumber) { if (tagable != null) { Iterator<Entry<TagW, Object>> iter = tagable.getTagEntrySetIterator(); while (iter.hasNext()) { Entry<TagW, Object> entry = iter.next(); TagW tag = entry.getKey(); if (tag != null && (dicomGroupNumber == null || TagUtils.groupNumber(tag.getId()) == dicomGroupNumber)) { if (this.containTagKey(tag)) { if (!TagUtil.isEquals(this.getTagValue(tag), entry.getValue())) { return false; } } else if (entry.getValue() != null) { return false; } } } } return true; }
public static void computeSlicePositionVector(Tagable tagable) { if (tagable != null) { double[] patientPos = TagD.getTagValue(tagable, Tag.ImagePositionPatient, double[].class); if (patientPos != null && patientPos.length == 3) { double[] imgOrientation = ImageOrientation .computeNormalVectorOfPlan(TagD.getTagValue(tagable, Tag.ImageOrientationPatient, double[].class)); if (imgOrientation != null) { double[] slicePosition = new double[3]; slicePosition[0] = imgOrientation[0] * patientPos[0]; slicePosition[1] = imgOrientation[1] * patientPos[1]; slicePosition[2] = imgOrientation[2] * patientPos[2]; tagable.setTag(TagW.SlicePosition, slicePosition); } } } }
public static void buildSeriesReferences(Tagable tagable, Attributes attributes) { Sequence seq = attributes.getSequence(Tag.ReferencedSeriesSequence); if (Objects.nonNull(seq)) { Attributes[] ref = new Attributes[seq.size()]; for (int i = 0; i < ref.length; i++) { ref[i] = new Attributes(seq.get(i)); } tagable.setTagNoNull(TagD.get(Tag.ReferencedSeriesSequence), ref); } }
public AcquireMetadataTableModel(Tagable tagable, TagW[] tagsToDisplay, TagW[] tagsEditable, TagW[] tagsToPublish) { this.tagable = Optional.ofNullable(tagable); this.tagsToPublish = tagsToPublish == null ? new TagW[0] : tagsToPublish; List<TagW> addTags = new ArrayList<>(); for (TagW tag : tagsToPublish) { if (tagable == null || tagable.getTagValue(tag) == null) { if (tagsToDisplay == null || !Arrays.stream(tagsToDisplay).filter(t -> t.equals(tag)).findFirst().isPresent()) { addTags.add(tag); } } } this.tagsToDisplay = getMoreTags(tagsToDisplay, addTags); this.tagsEditable = getMoreTags(tagsEditable, addTags); }
public void init(Tagable tagable) { clear(); tags.put(TagD.get(Tag.StudyInstanceUID), UIDUtils.createUID()); if (tagable != null) { tagable.getTagEntrySetIterator().forEachRemaining(i -> { TagW tag = i.getKey(); if (tag != null) { tags.put(tag, i.getValue()); } }); } allowFullEdition = getTagValue(TagD.get(Tag.PatientID)) == null || getTagValue(TagD.get(Tag.PatientName)) == null; }
public static void setShutterColor(Tagable tagable, Attributes attributes) { Integer psVal = (Integer) TagD.get(Tag.ShutterPresentationValue).getValue(attributes); tagable.setTagNoNull(TagW.ShutterPSValue, TagD.get(Tag.ShutterPresentationValue).getValue(attributes)); float[] rgb = CIELab.convertToFloatLab((int[]) TagD.get(Tag.ShutterPresentationColorCIELabValue).getValue(attributes)); Color color = rgb == null ? null : PresentationStateReader.getRGBColor(psVal == null ? 0 : psVal, rgb, (int[]) null); tagable.setTagNoNull(TagW.ShutterRGBColor, color); }
tagable.setTagNoNull(TagW.ShutterFinalShape, shape);
tagable.setTag(TagW.SuvFactor, suvFactor);