Skip to content

Commit

Permalink
Update ImporterManagerService.java
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkain committed Oct 23, 2023
1 parent 1a87c3d commit 1c7e8c4
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public void manageImportJob(final ImportJob importJob) {
if (!userImportDir.exists()) {
userImportDir.mkdirs(); // create if not yet existing, e.g. in case of PACS import
}
// 1. call to cleanSeries: remove ignored series, that have been detected to be ignored by the
// uploadDicomZipFile (DicomDirToModelService) or the QueryPACSService (either from ShUp or the
// web-gui-pacs import), see usage of DicomSerieAndInstanceAnalyzer and e.g. missing instances
cleanSeries(importJob);
List<Patient> patients = importJob.getPatients();
// In PACS import the dicom files are still in the PACS, we have to download them first
// and then analyze them: what gives us a list of images for each serie.
Expand All @@ -142,8 +146,10 @@ public void manageImportJob(final ImportJob importJob) {
} else {
throw new ShanoirException("Unsupported type of import.");
}
// we do the clean series here: at this point we are sure for all imports, that the ImagesCreatorAndDicomFileAnalyzer
// 2. call to cleanSeries: at this point we are sure for all imports, that the ImagesCreatorAndDicomFileAnalyzer
// has been run and correctly classified everything. So no need to check afterwards for erroneous series.
// So two possibilities to remove series: 1. call, via the info from the dicomdir or the info from the pacs
// 2. call, via analysis of dicom files itself and their content
cleanSeries(importJob);

event.setProgress(0.25F);
Expand Down Expand Up @@ -177,6 +183,7 @@ public void manageImportJob(final ImportJob importJob) {
* pacs or from-sh-up it is different, as the ImagesCreatorAndDicomFileAnalyzer is called afterwards.
* Same here for multi-exam-imports: it calls uploadDicomZipFile method, where series could be classed
* as erroneous and when startImportJob is called, we want them to be removed from the import.
* As the DicomSerieAndInstanceAnalyzer can declare a serie as ignored as well, we clean twice.
*
* @param importJob
*/
Expand All @@ -189,8 +196,8 @@ private void cleanSeries(final ImportJob importJob) {
List<Serie> series = study.getSeries();
for (Iterator<Serie> serieIt = series.iterator(); serieIt.hasNext();) {
Serie serie = serieIt.next();
if (serie.isIgnored() || serie.isErroneous() || !serie.getSelected()) {
LOG.info("Serie {} cleaned from import (ignored, erroneous, not selected).", serie.getSeriesDescription());
if (!serie.getSelected() || serie.isIgnored() || serie.isErroneous()) {
LOG.info("Serie {} cleaned from import (not selected, ignored, erroneous).", serie.getSeriesDescription());
serieIt.remove();
}
}
Expand Down

0 comments on commit 1c7e8c4

Please sign in to comment.