Delete a study from local archive (dicomdir)

101 views
Skip to first unread message

Thanasis Iliopoulos

unread,
Jun 8, 2019, 12:16:31 PM6/8/19
to dcm...@googlegroups.com
Hi all,

I am using dcm4che3 toolkit to build an application that is essentially going to be a simple Image Archive (https://github.com/dcm4che/dcm4che/tree/master/dcm4che-tool/dcm4che-tool-dcmqrscp) able to forward studies on demand to other modalities.The tool also implements a s-store scu service to query itself but also other modalities.

A requirement is to able and "delete" periodically studies from this local archive.

I am also new to the dicom protocol and dcm4che, so i am trying to understand the logic of the underlying dicomdir (used by dcm4che-tool-dcmqrscp) as also any available services or methods for deleting studies.

So my questions are the following:

  • In the context of dicom protocol is it valid the term: "Delete a study"?
  • As i can see the "dcm4che-tool-dcmdir" when deleting a study (using the tool), what happens actually is to "delete records referring DICOM files specified by file.. or directory.. arguments from existing directory file <dicomdir> by setting its Record In-use Flag = 0" so the files remain on the filesystem.
  • Even more if i try and delete a study in this way (-d option in tool-dicomdir) when i query the archive with my c-find scu, i can find the study.
  • If i try and delete study files manually from the filesystem i guess that the dicomdir becomes corrupted.
Are there any other ways (or part of protocol) for deleting in consistent way a study (permanently from dicomdir records but also from filesystem if possibly) from the dicomdir?

The code i use to delete the study (using similar approach with -d option in dicomdir) is:

public void deleteDicomDir(String studyDir) throws IOException {
        
        DcmDir1 main = new DcmDir1();
        
        long start = System.currentTimeMillis();
        LOG.info("$$$ Trying to delete dicomdir: " + studyDir);
        main.open(new File("C:\\dicomrouter_dev\\dcmrouter_root\\dicomdir"));
        int num = 0;
        //for (String arg : argList)
            //num += main.removeReferenceTo(new File("C:\\dicomrouter_dev\\dcmrouter_root\\DICOM\\CAA4E168\\91BAC858"));
            num += main.removeReferenceTo(new File(studyDir));
        main.close();
        long end = System.currentTimeMillis();
        System.out.println();
        System.out.println(MessageFormat.format(
            rb.getString("deleted"),
            num, main.getFile(), (end - start)));
}

Thanks for your time and i am looking forward for any info that will declare this
Reply all
Reply to author
Forward
0 new messages