0
votes

i am trying to DICOM Send a dicomized pdf file to PACS and attach it to an already existing study in a separate node (as a different series). The exception i get is the following:

org.dcm4che.net.DcmServiceException: SOP Instance UID in Dataset [2.25.227860789054905865463149387539476701251] differs from Affected SOP Instance UID[1.3.12.2.1107.5.2.30.26419.20
15022512062559209947045]
    at org.dcm4chex.archive.dcm.storescp.StoreScp.checkSOPInstanceUID(StoreScp.java:1334)

in the dizomized pdf i am sending i have repopulated all required tags for the study with the following code:

public void repopulateAnonData(String strDcmFilePath, DicomSeriesMeta dcmMeta) throws IOException {

    log.info("repopulating anonymized data for file: " + strDcmFilePath);
    CheckIfIsDicom dcmCheck = new CheckIfIsDicom();

    Path dcmFilePath = Paths.get(strDcmFilePath);

    DicomObject dcmObj6;
    DicomInputStream din6 = null;
    din6 = new DicomInputStream(dcmFilePath.toFile());
    dcmObj6 = din6.readDicomObject();

    try {

        log.info("Repopulating AccessionNumber: " + dcmMeta.getAccessionNumber());
        dcmObj6.putString(Tag.AccessionNumber, VR.SH ,dcmMeta.getAccessionNumber());

        log.info("Repopulating InstitutionAddress: " + dcmMeta.getInstitutionAddress());
        dcmObj6.putString(Tag.InstitutionAddress, VR.ST ,dcmMeta.getInstitutionAddress());

        log.info("Repopulating InstitutionName: " + dcmMeta.getInstitutionName());
        dcmObj6.putString(Tag.InstitutionName, VR.LO ,dcmMeta.getInstitutionName());

        log.info("Repopulating IssuerOfPatientID: " + dcmMeta.getIssuerOfPatientID());
        dcmObj6.putString(Tag.IssuerOfPatientID, VR.LO ,dcmMeta.getIssuerOfPatientID());

        log.info("Repopulating MediaStorageSOPInstanceUID: " + dcmMeta.getMediaStorageSOPInstanceUID());
        dcmObj6.putString(Tag.MediaStorageSOPInstanceUID, VR.UI ,dcmMeta.getMediaStorageSOPInstanceUID());

        log.info("Repopulating OperatorsName: " + dcmMeta.getOperatorsName());
        dcmObj6.putString(Tag.OperatorsName, VR.PN ,dcmMeta.getOperatorsName());

        log.info("Repopulating OtherPatientIDs: " + dcmMeta.getOtherPatientIDs());
        dcmObj6.putString(Tag.OtherPatientIDs, VR.LO ,dcmMeta.getOtherPatientIDs());

        log.info("Repopulating PatientAge: " + dcmMeta.getPatientAge());
        dcmObj6.putString(Tag.PatientAge, VR.AS ,dcmMeta.getPatientAge());

        log.info("Repopulating PatientBirthDate: " + dcmMeta.getPatientBirthDate());
        dcmObj6.putString(Tag.PatientBirthDate, VR.DA ,dcmMeta.getPatientBirthDate());

        log.info("Repopulating PatientID: " + dcmMeta.getPatientID());
        dcmObj6.putString(Tag.PatientID, VR.LO ,dcmMeta.getPatientID());

        log.info("Repopulating PatientName: " + dcmMeta.getPatientName());
        dcmObj6.putString(Tag.PatientName, VR.PN ,dcmMeta.getPatientName());

        log.info("Repopulating PatientSex: " + dcmMeta.getPatientSex());
        dcmObj6.putString(Tag.PatientSex, VR.CS ,dcmMeta.getPatientSex());

        log.info("Repopulating PhysiciansOfRecord: " + dcmMeta.getPhysiciansOfRecord());
        dcmObj6.putString(Tag.PhysiciansOfRecord,VR.PN ,dcmMeta.getPhysiciansOfRecord());

        log.info("Repopulating ReferringPhysicianName: " + dcmMeta.getReferringPhysicianName());
        dcmObj6.putString(Tag.ReferringPhysicianName, VR.PN ,dcmMeta.getReferringPhysicianName());

        log.info("Repopulating RequestingPhysician: " + dcmMeta.getRequestingPhysician());
        dcmObj6.putString(Tag.RequestingPhysician, VR.PN ,dcmMeta.getRequestingPhysician());

        //log.info("Repopulating SOPInstanceUID: " + dcmMeta.getsOPInstanceUID());
        //dcmObj6.putString(Tag.SOPInstanceUID, VR.UI ,dcmMeta.getsOPInstanceUID());

        log.info("Repopulating StudyDate: " + dcmMeta.getStudyDate());
        dcmObj6.putString(Tag.StudyDate, VR.DA ,dcmMeta.getStudyDate());

        log.info("Repopulating StudyID: " + dcmMeta.getStudyID());
        dcmObj6.putString(Tag.StudyID, VR.SH ,dcmMeta.getStudyID());

        log.info("Repopulating StudyInstanceUID: " + dcmMeta.getStudyInstanceUID());
        dcmObj6.putString(Tag.StudyInstanceUID, VR.UI,dcmMeta.getStudyInstanceUID());            

        log.info("Repopulating SeriesDescription: " + "REPORT");
        dcmObj6.putString(Tag.SeriesDescription, VR.LO,"REPORT");

        FileOutputStream fos = new FileOutputStream( new File(dcmFilePath.toString()), false);
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        DicomOutputStream dos = new DicomOutputStream(bos);

        dos.writeDicomFile(dcmObj6);                

        dos.close();
        bos.close();
        fos.close();

    } catch (Exception ex) {
        log.log(Level.ERROR, null, ex);;
    } finally {
        din6.close();
        if (!dcmCheck.checkIfDicomObjectFileB(dcmFilePath.toFile())) {
                log.info("Fetched file is not a DICOM.");
        }
    }

    CheckIfIsDicom checker = new CheckIfIsDicom();
    try {
            if(checker.checkIfDicomObjectFileB(dcmFilePath.toFile())) {
                log.info("Dicomization SUCCESS!");
                ParseDicomHeader parseHeader =  new ParseDicomHeader();
                parseHeader.parseDicomHeaderFile(dcmFilePath.toFile());
            } else {
                log.info("Dicomization NOT SUCCESS!");
            }
    } catch (IOException ex) {
            log.log(Level.ERROR, null, ex);
    }            

}

However i have not repopulated SeriesInstanceUID and SOPInstanceUID since i want the dicom file to be stored under a specific study in a different series node but studyID is the same as the existing study (in pacs) under of which i am trying to store this dicom.

However pacs server seem not to accept a dicom with a different SOPInstanceUID ...

Any ideas of what am i missing?

1
thanili, I see you edited the original exception. That makes following this discussion very confusing and difficult. Anyway, your new exception indicates that two matching tags should be the same - have you tried making them the same? The errors from DCM4CHEE are usually pretty explicit and should be able to help you through your issues.cneller

1 Answers

5
votes

The issue is that you are storing an instance with an instance UID that is already in the archive. The archive is refusing it, because storage would conflict with the existing series instance UID for that instance.

If you want this new object stored in a different study then you need different instance, series and study UIDs. If you want it in the same study but different series then you need different instance and series UIDs, but an identical study UID.