Projects >> Weasis >>92c44688523a65d4ba65ef4ecf62f146521af7b7

Chunk
Conflicting content
                            }

                            if (writer != null) {
<<<<<<< HEAD

                                Attributes fmi = null;
                                Attributes dataset = null;
                                // DicomInputStream din = null;
                                // try {
                                // din = new DicomInputStream(destinationFile);
                                // din.setIncludeBulkData(IncludeBulkData.NO);
                                // fmi = din.readFileMetaInformation();
                                // dataset = din.readDataset(-1, Tag.PixelData);
                                // } catch (IOException e) {
                                //                                    LOGGER.error("Cannot export DICOM file: ", img.getFile()); //$NON-NLS-1$
                                // } finally {
                                // FileUtil.safeClose(din);
                                // }
                                DicomMediaIO dicomImageLoader = (DicomMediaIO) img.getMediaReader();
                                dataset = dicomImageLoader.getDicomObject();
                                if (dataset == null) {
                                    LOGGER.error("Cannot export DICOM file: ", img.getFile()); //$NON-NLS-1$
                                    continue TreePath;
                                }
                                fmi = dataset.createFileMetaInformation(UID.ImplicitVRLittleEndian);

                                String miuid = fmi.getString(Tag.MediaStorageSOPInstanceUID, null);

                                String pid = dataset.getString(Tag.PatientID, null);
                                String styuid = dataset.getString(Tag.StudyInstanceUID, null);
                                String seruid = dataset.getString(Tag.SeriesInstanceUID, null);
                                Attributes seriesRec = null;

                                if (styuid != null && seruid != null) {
                                    if (pid == null) {
                                        dataset.setString(Tag.PatientID, VR.LO, pid = styuid);
                                    }
                                    Attributes patRec = writer.findPatientRecord(pid);
                                    if (patRec == null) {
                                        patRec =
                                            DicomDirLoader.RecordFactory.createRecord(RecordType.PATIENT, null,
                                                dataset, null, null);
                                        writer.addRootDirectoryRecord(patRec);
                                    }
                                    Attributes studyRec = writer.findStudyRecord(patRec, styuid);
                                    if (studyRec == null) {
                                        studyRec =
                                            DicomDirLoader.RecordFactory.createRecord(RecordType.STUDY, null, dataset,
                                                null, null);
                                        writer.addLowerDirectoryRecord(patRec, studyRec);
                                    }
                                    seriesRec = writer.findSeriesRecord(studyRec, seruid);
                                    if (seriesRec == null) {
                                        seriesRec =
                                            DicomDirLoader.RecordFactory.createRecord(RecordType.SERIES, null, dataset,
                                                null, null);
                                        writer.addLowerDirectoryRecord(studyRec, seriesRec);
                                    }
                                    Attributes instRec;

                                    if (writer.findLowerInstanceRecord(seriesRec, false, iuid) == null) {
                                        instRec =
                                            DicomDirLoader.RecordFactory.createRecord(dataset, fmi,
                                                writer.toFileIDs(destinationFile));
                                        writer.addLowerDirectoryRecord(seriesRec, instRec);
                                    }
                                } else {
                                    if (writer.findRootInstanceRecord(false, miuid) == null) {
                                        Attributes instRec =
                                            DicomDirLoader.RecordFactory.createRecord(dataset, fmi,
                                                writer.toFileIDs(destinationFile));
                                        writer.addRootDirectoryRecord(instRec);
                                    }
                                }
                                // Icon Image Sequence (0088,0200).This Icon Image is representative of the Series.
                                // It may or may not correspond to one of the images of the Series.
                                if (newSeries && seriesRec != null
                                    && node.getParent() instanceof DefaultMutableTreeNode) {
                                    DicomImageElement midImage =
                                        ((DicomSeries) ((DefaultMutableTreeNode) node.getParent()).getUserObject())
                                            .getMedia(MediaSeries.MEDIA_POSITION.MIDDLE, null, null);
                                    Attributes iconItem = mkIconItem(midImage);
                                    if (iconItem != null) {
                                        seriesRec.newSequence(Tag.IconImageSequence, 1).add(iconItem);
                                    }
=======
                                DicomInputStream in = null;
                                DicomObject dcmobj;
                                try {
                                    in = new DicomInputStream(destinationFile);
                                    in.setHandler(new StopTagInputHandler(Tag.PixelData));
                                    dcmobj = in.readDicomObject();
                                } finally {
                                    FileUtil.safeClose(in);
>>>>>>> 91de3a31a589683201ff9db09c54eeef1596eeba
                                }
                                DicomObject patrec = dicomStruct.makePatientDirectoryRecord(dcmobj);
                                DicomObject styrec = dicomStruct.makeStudyDirectoryRecord(dcmobj);
Solution content
                            }

                            if (writer != null) {

                                Attributes fmi = null;
                                Attributes dataset = null;
                                // DicomInputStream din = null;
                                // try {
                                // din = new DicomInputStream(destinationFile);
                                // din.setIncludeBulkData(IncludeBulkData.NO);
                                // fmi = din.readFileMetaInformation();
                                // dataset = din.readDataset(-1, Tag.PixelData);
                                // } catch (IOException e) {
                                //                                    LOGGER.error("Cannot export DICOM file: ", img.getFile()); //$NON-NLS-1$
                                // } finally {
                                // FileUtil.safeClose(din);
                                // }
                                DicomMediaIO dicomImageLoader = (DicomMediaIO) img.getMediaReader();
                                dataset = dicomImageLoader.getDicomObject();
                                if (dataset == null) {
                                    LOGGER.error("Cannot export DICOM file: ", img.getFile()); //$NON-NLS-1$
                                    continue TreePath;
                                }
                                fmi = dataset.createFileMetaInformation(UID.ImplicitVRLittleEndian);

                                String miuid = fmi.getString(Tag.MediaStorageSOPInstanceUID, null);

                                String pid = dataset.getString(Tag.PatientID, null);
                                String styuid = dataset.getString(Tag.StudyInstanceUID, null);
                                String seruid = dataset.getString(Tag.SeriesInstanceUID, null);
                                Attributes seriesRec = null;

                                if (styuid != null && seruid != null) {
                                    if (pid == null) {
                                        dataset.setString(Tag.PatientID, VR.LO, pid = styuid);
                                    }
                                    Attributes patRec = writer.findPatientRecord(pid);
                                    if (patRec == null) {
                                        patRec =
                                            DicomDirLoader.RecordFactory.createRecord(RecordType.PATIENT, null,
                                                dataset, null, null);
                                        writer.addRootDirectoryRecord(patRec);
                                    }
                                    Attributes studyRec = writer.findStudyRecord(patRec, styuid);
                                    if (studyRec == null) {
                                        studyRec =
                                            DicomDirLoader.RecordFactory.createRecord(RecordType.STUDY, null, dataset,
                                                null, null);
                                        writer.addLowerDirectoryRecord(patRec, studyRec);
                                    }
                                    seriesRec = writer.findSeriesRecord(studyRec, seruid);
                                    if (seriesRec == null) {
                                        seriesRec =
                                            DicomDirLoader.RecordFactory.createRecord(RecordType.SERIES, null, dataset,
                                                null, null);
                                        writer.addLowerDirectoryRecord(studyRec, seriesRec);
                                    }
                                    Attributes instRec;

                                    if (writer.findLowerInstanceRecord(seriesRec, false, iuid) == null) {
                                        instRec =
                                            DicomDirLoader.RecordFactory.createRecord(dataset, fmi,
                                                writer.toFileIDs(destinationFile));
                                        writer.addLowerDirectoryRecord(seriesRec, instRec);
                                    }
                                } else {
                                    if (writer.findRootInstanceRecord(false, miuid) == null) {
                                        Attributes instRec =
                                            DicomDirLoader.RecordFactory.createRecord(dataset, fmi,
                                                writer.toFileIDs(destinationFile));
                                        writer.addRootDirectoryRecord(instRec);
                                    }
                                }
                                // Icon Image Sequence (0088,0200).This Icon Image is representative of the Series.
                                // It may or may not correspond to one of the images of the Series.
                                if (newSeries && seriesRec != null
                                    && node.getParent() instanceof DefaultMutableTreeNode) {
                                    DicomImageElement midImage =
                                        ((DicomSeries) ((DefaultMutableTreeNode) node.getParent()).getUserObject())
                                            .getMedia(MediaSeries.MEDIA_POSITION.MIDDLE, null, null);
                                    Attributes iconItem = mkIconItem(midImage);
                                    if (iconItem != null) {
                                        seriesRec.newSequence(Tag.IconImageSequence, 1).add(iconItem);
                                    }
                                }
File
LocalExport.java
Developer's decision
Combination
Kind of conflict
Cast expression
Comment
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
        return toHex(uid.hashCode());
    }

<<<<<<< HEAD
    public static Attributes mkIconItem(DicomImageElement image) {
=======
    public static DicomObject mkIconItem(DicomImageElement image) {
>>>>>>> 91de3a31a589683201ff9db09c54eeef1596eeba
        if (image == null) {
            return null;
        }
Solution content
        return toHex(uid.hashCode());
    }

    public static Attributes mkIconItem(DicomImageElement image) {
        if (image == null) {
            return null;
        }
File
LocalExport.java
Developer's decision
Version 1
Kind of conflict
Method signature