public Image(DicomImageElement image) { // Determine if the patient is prone or supine Attributes dcmItems = image.getMediaReader().getDicomObject(); this.patientPosition = dcmItems.getString(Tag.PatientPosition).toLowerCase(); this.prone = patientPosition.contains("p") ? -1 : 1; this.feetFirst = patientPosition.contains("ff") ? -1 : 1; // Get the image pixel spacing this.imageSpacing = image.getSliceGeometry().getVoxelSpacingArray(); }
private static boolean writeInDicomDir(DicomDirWriter writer, MediaElement img, DefaultMutableTreeNode node, String iuid, File destinationFile) throws IOException { if (writer != null) { if (!(img.getMediaReader() instanceof DcmMediaReader) || ((DcmMediaReader) img.getMediaReader()).getDicomObject() == null) { LOGGER.error("Cannot export DICOM file: ", img.getFileCache().getOriginalFile().orElse(null)); //$NON-NLS-1$ return false; } return writeInDicomDir(writer, ((DcmMediaReader) img.getMediaReader()).getDicomObject(), node, iuid, destinationFile); } return false; }
public static Attributes writePresentation(GraphicModel model, DicomImageElement img, File outputFile, String seriesInstanceUID, String sopInstanceUID) { Attributes imgAttributes = img.getMediaReader() instanceof DcmMediaReader ? ((DcmMediaReader) img.getMediaReader()).getDicomObject() : null; return writePresentation(model, imgAttributes, outputFile, seriesInstanceUID, sopInstanceUID, null); }
public static Attributes buildAndWritePR(MediaElement img, boolean keepNames, File destinationDir, DicomDirWriter writer, DefaultMutableTreeNode node, String seriesInstanceUID) { Attributes imgAttributes = img.getMediaReader() instanceof DcmMediaReader ? ((DcmMediaReader) img.getMediaReader()).getDicomObject() : null; if (imgAttributes != null) { GraphicModel grModel = (GraphicModel) img.getTagValue(TagW.PresentationModel); if (grModel != null && grModel.hasSerializableGraphics()) { String prUid = UIDUtils.createUID(); File outputFile = new File(destinationDir, keepNames ? prUid : makeFileIDs(prUid)); destinationDir.mkdirs(); Attributes prAttributes = DicomPrSerializer.writePresentation(grModel, imgAttributes, outputFile, seriesInstanceUID, prUid); if (prAttributes != null) { try { writeInDicomDir(writer, prAttributes, node, outputFile.getName(), outputFile); } catch (IOException e) { LOGGER.error("Writing DICOMDIR", e); //$NON-NLS-1$ } } } } return imgAttributes; }
public static Attributes createNewDicomKeyObject(MediaElement dicomMediaElement, Component parentComponent) { if (dicomMediaElement != null && dicomMediaElement.getMediaReader() instanceof DcmMediaReader) { Attributes dicomSourceAttribute = ((DcmMediaReader) dicomMediaElement.getMediaReader()).getDicomObject(); String message = Messages.getString("KOManager.ko_desc"); //$NON-NLS-1$ String defautDescription = Messages.getString("KOManager.ko_name"); //$NON-NLS-1$ String description = (String) JOptionPane.showInputDialog(parentComponent, message, Messages.getString("KOManager.ko_title"), //$NON-NLS-1$ JOptionPane.INFORMATION_MESSAGE, null, null, defautDescription); // description==null means the user canceled the input if (StringUtil.hasText(description)) { Attributes ko = DicomMediaUtils.createDicomKeyObject(dicomSourceAttribute, description, null); if (dicomMediaElement instanceof KOSpecialElement) { Collection<HierachicalSOPInstanceReference> referencedStudySequence = new KODocumentModule(dicomSourceAttribute).getCurrentRequestedProcedureEvidences(); new KODocumentModule(ko).setCurrentRequestedProcedureEvidences(referencedStudySequence); } return ko; } } return null; }
printAttribute(((DcmMediaReader) loader).getDicomObject(), doc);
Attributes dcmItems = ((DcmMediaReader) rtElement.getMediaReader()).getDicomObject(); if (dcmItems != null) {
private KOSpecialElement buildKO(DicomModel model, DicomSeries s) { DicomSpecialElement dcmElement = DicomModel.getFirstSpecialElement(series, DicomSpecialElement.class); if (dcmElement != null) { DicomImageElement dcm = s.getMedia(MediaSeries.MEDIA_POSITION.FIRST, null, null); if (dcm != null && dcm.getMediaReader() instanceof DcmMediaReader) { Attributes dicomSourceAttribute = ((DcmMediaReader) dcm.getMediaReader()).getDicomObject(); Attributes attributes = DicomMediaUtils.createDicomKeyObject(dicomSourceAttribute, dcmElement.getShortLabel(), null); new LoadDicomObjects(model, attributes).addSelectionAndnotify(); // must be executed in the EDT for (KOSpecialElement koElement : DicomModel.getKoSpecialElements(s)) { if (koElement.getMediaReader().getDicomObject().equals(attributes)) { return koElement; } } } } return null; }
final Attributes attributes = ((DcmMediaReader) img.getMediaReader()).getDicomObject(); final int[] COPIED_ATTRS = { Tag.SpecificCharacterSet, Tag.PatientID, Tag.PatientName, Tag.PatientBirthDate, Tag.PatientBirthTime, Tag.PatientSex, Tag.IssuerOfPatientID, Tag.IssuerOfAccessionNumberSequence,
final Attributes attributes = ((DcmMediaReader) img.getMediaReader()).getDicomObject();