public void readTags(Level level, Attributes header, Tagable tags) { if (level == null || header == null || tags == null) { return; } List<TagW> list = levelMap.get(level); if (list != null) { for (TagW tagW : list) { tagW.readValue(header, tags); } } } }
public static void applyModalityLutModule(Attributes mLutItems, Tagable tagable, Integer seqParentTag) { if (mLutItems != null && tagable != null) { // Overrides Modality LUT Transformation attributes only if sequence is consistent if (containsRequiredModalityLUTAttributes(mLutItems)) { String modlality = TagD.getTagValue(tagable, Tag.Modality, String.class); if ("MR".equals(modlality) || "XA".equals(modlality) || "XRF".equals(modlality) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ || "PT".equals(modlality)) { //$NON-NLS-1$ /* * IHE BIR: 4.16.4.2.2.5.4 * * The grayscale rendering pipeline shall be appropriate to the SOP Class and modality. If Rescale * Slope and Rescale Intercept are present in the image for MR and PET and XA/XRF images, they shall * be ignored from the perspective of applying window values, and for those SOP Classes, window * values shall be applied directly to the stored pixel values without rescaling. */ LOGGER.trace("Do not apply RescaleSlope and RescaleIntercept to {}", modlality);//$NON-NLS-1$ } else { TagD.get(Tag.RescaleSlope).readValue(mLutItems, tagable); TagD.get(Tag.RescaleIntercept).readValue(mLutItems, tagable); TagD.get(Tag.RescaleType).readValue(mLutItems, tagable); } } else if (seqParentTag != null) { LOGGER.warn("Cannot apply Modality LUT from {} with inconsistent attributes", //$NON-NLS-1$ TagUtils.toString(seqParentTag)); } // Should exist only in root DICOM (when seqParentTag == null) buildMoalityLUT(mLutItems.getNestedDataset(Tag.ModalityLUTSequence), tagable); } }
private void readXmlTag(TagW tag, Node node, DefaultTagable def) { // TODO implement DICOM XML : http://dicom.nema.org/medical/dicom/current/output/chtml/part19/chapter_A.html if (tag instanceof TagSeq && node.hasChildNodes()) { NodeList nodeList = node.getChildNodes(); Attributes attributes = new Attributes(); // FIXME handle only one sequence element Attributes[] list = new Attributes[1]; for (int i = 0; i < nodeList.getLength(); i++) { Node n = nodeList.item(i); if (n != null) { Optional.ofNullable(TagD.get(n.getNodeName())).ifPresent(t -> attributes.setValue(t.getId(), ElementDictionary.vrOf(t.getId(), null), n.getTextContent())); } } list[0] = attributes.getParent() == null ? attributes : new Attributes(attributes); def.setTagNoNull(tag, list); } else { tag.readValue(node.getTextContent(), def); } }
public void readDisplayArea(DicomImageElement img) { if (dcmobj != null) { TagW[] tagList = TagD.getTagFromIDs(Tag.PresentationPixelSpacing, Tag.PresentationPixelAspectRatio, Tag.PixelOriginInterpretation, Tag.PresentationSizeMode, Tag.DisplayedAreaTopLeftHandCorner, Tag.DisplayedAreaBottomRightHandCorner, Tag.PresentationPixelMagnificationRatio); TagSeq.MacroSeqData data = new TagSeq.MacroSeqData(dcmobj, tagList, isSequenceApplicable(img)); TagD.get(Tag.DisplayedAreaSelectionSequence).readValue(data, this); } }
TagD.get(Tag.WindowWidth).readValue(voiItems, tagable); TagD.get(Tag.WindowCenter).readValue(voiItems, tagable); double[] ww = TagD.getTagValue(tagable, Tag.WindowWidth, double[].class); double[] wc = TagD.getTagValue(tagable, Tag.WindowCenter, double[].class); TagD.get(Tag.WindowCenterWidthExplanation).readValue(voiItems, tagable); TagD.get(Tag.VOILUTFunction).readValue(voiItems, tagable);
@Override public void readValue(Object data, Tagable tagabale) { if (data instanceof MacroSeqData) { MacroSeqData macro = (MacroSeqData) data; Object val = getValue(macro.getAttributes()); if (val instanceof Sequence) { Sequence seq = (Sequence) val; if (!seq.isEmpty()) { val = seq.get(0); } } if (val instanceof Attributes) { Attributes dataset = (Attributes) val; Predicate<? super Attributes> predicate = macro.getApplicable(); if (predicate == null || predicate.test(dataset)) { for (TagW tag : macro.getTags()) { if (tag != null) { tag.readValue(dataset, tagabale); } } } } } }
TagD.get(Tag.PixelMeasuresSequence).readValue(data, tagable); TagD.get(Tag.FrameContentSequence).readValue(data, tagable); TagD.get(Tag.PlanePositionSequence).readValue(data, tagable); TagD.get(Tag.PlaneOrientationSequence).readValue(data, tagable); TagD.get(Tag.FrameAnatomySequence).readValue(data, tagable); TagD.get(Tag.MRImageFrameTypeSequence).readValue(data, tagable); TagD.get(Tag.CTImageFrameTypeSequence).readValue(data, tagable); TagD.get(Tag.MRSpectroscopyFrameTypeSequence).readValue(data, tagable); TagD.get(Tag.PETFrameTypeSequence).readValue(data, tagable);
/** * @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); } } } }
private void writeImageValues(Attributes header) { if (header != null && hasPixel) { TagD.get(Tag.ImagePositionPatient).readValue(header, this); TagD.get(Tag.ImageOrientationPatient).readValue(header, this); setTagNoNull(TagW.ImageOrientationPlane, ImageOrientation.makeImageOrientationLabelFromImageOrientationPatient( setTagNoNull(TagD.get(Tag.PixelRepresentation), pixelRepresentation); TagD.get(Tag.PixelSpacing).readValue(header, this); TagD.get(Tag.PixelAspectRatio).readValue(header, this); TagD.get(Tag.PixelSpacingCalibrationDescription).readValue(header, this); TagD.get(Tag.ImagerPixelSpacing).readValue(header, this); TagD.get(Tag.NominalScannedPixelSpacing).readValue(header, this); TagD.get(Tag.PixelIntensityRelationship).readValue(header, this); TagD.get(Tag.Units).readValue(header, this); TagD.get(Tag.NumberOfFrames).readValue(header, this); setTagNoNull(TagW.HasOverlay, DicomMediaUtils.hasOverlay(header)); TagD.get(Tag.PresentationLUTShape).readValue(header, this); setTag(TagD.get(Tag.PhotometricInterpretation), photometricInterpretation); setTag(TagW.MonoChrome, TagD.get(Tag.LossyImageCompressionRatio).readValue(header, this); TagD.get(Tag.LossyImageCompressionMethod).readValue(header, this); TagD.get(Tag.DerivationDescription).readValue(header, this);
tag.readValue(header, this);
private boolean applySelection() { if (selectedItem != null) { DefaultTagable tagable = new DefaultTagable(); TagW[] addTags = TagD.getTagFromIDs(Tag.AccessionNumber, Tag.IssuerOfAccessionNumberSequence, Tag.ReferringPhysicianName, Tag.PatientName, Tag.PatientID, Tag.IssuerOfPatientID, Tag.PatientBirthDate, Tag.PatientSex, Tag.PatientWeight, Tag.MedicalAlerts, Tag.Allergies, Tag.PregnancyStatus, Tag.StudyInstanceUID, Tag.RequestingPhysician, Tag.RequestingService, Tag.RequestedProcedureDescription, Tag.RequestedProcedureCodeSequence, Tag.AdmissionID, Tag.IssuerOfAdmissionIDSequence, Tag.SpecialNeeds, Tag.CurrentPatientLocation, Tag.PatientState); for (TagW t : addTags) { t.readValue(selectedItem, tagable); } Attributes seq = selectedItem.getNestedDataset(Tag.ScheduledProcedureStepSequence); tagable.setTagNoNull(TagD.get(Tag.StudyDescription), TagD.get(Tag.ScheduledProcedureStepDescription).getValue(seq)); TagW tModality = TagD.get(Tag.Modality); tagable.setTagNoNull(tModality, tModality.getValue(seq)); tagable.setTagNoNull(TagD.get(Tag.StationName), TagD.get(Tag.ScheduledStationName).getValue(seq)); AcquireManager.getInstance().applyToGlobal(tagable); selectedItem = null; selection.setText(""); //$NON-NLS-1$ jtable.getSelectionModel().clearSelection(); return true; } return false; }
private static MediaSeriesGroup readStudy(XMLStreamReader xmler, ReaderParams params, MediaSeriesGroup patient, WadoParameters wadoParameters) throws XMLStreamException { DicomModel model = params.getModel(); String studyUID = (String) TagD.getUID(Level.STUDY).getValue(xmler); MediaSeriesGroup study = model.getHierarchyNode(patient, studyUID); if (study == null) { study = new MediaSeriesGroupNode(TagD.getUID(Level.STUDY), studyUID, DicomModel.study.getTagView()); TagW[] tags = TagD.getTagFromIDs(Tag.StudyDate, Tag.StudyTime, Tag.StudyDescription, Tag.AccessionNumber, Tag.StudyID); for (TagW tag : tags) { tag.readValue(xmler, study); } model.addHierarchyNode(patient, study); } final MediaSeriesGroup study2 = study; BiConsumerWithException<XMLStreamReader, ReaderParams, XMLStreamException> method = (x, r) -> readSeries(x, r, patient, study2, wadoParameters); readElement(xmler, TagD.Level.SERIES.getTagName(), TagD.Level.STUDY.getTagName(), method, params); return study; }
TagD.getTagFromIDs(Tag.Modality, Tag.SeriesNumber, Tag.SeriesDescription, Tag.ReferringPhysicianName); for (TagW tag : tags) { tag.readValue(xmler, dicomSeries);
tag.readValue(xmler, patient);