Skip to content

Commit

Permalink
Failed to send to DICOM archive #577
Browse files Browse the repository at this point in the history
  • Loading branch information
nroduit committed Aug 19, 2024
1 parent 0c3d134 commit 76d5355
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,12 @@ private void writeDicom(ExplorerTask<Boolean, String> task, File writeDir, Check
}

String path = LocalExport.buildPath(img, false, false, node, null);
if (saveFile(writeDir, img, iuid, path)) {
return;
}
saveFile(writeDir, img, iuid, path);
} else if (node.getUserObject() instanceof DicomElement dcm) {
String iuid = TagD.getTagValue((TagReadable) dcm, Tag.SOPInstanceUID, String.class);

String path = LocalExport.buildPath((MediaElement) dcm, false, false, node, null);
if (saveFile(writeDir, dcm, iuid, path)) {
return;
}
saveFile(writeDir, dcm, iuid, path);
} else if (node.getUserObject() instanceof MediaSeries<?> s)
saveOtherMediaSeries(writeDir, s, node);
}
Expand All @@ -200,15 +196,10 @@ private static void saveOtherMediaSeries(
}
}

private boolean saveFile(File writeDir, DicomElement dcm, String iuid, String path) {
private void saveFile(File writeDir, DicomElement dcm, String iuid, String path) {
File destinationDir = new File(writeDir, path);
if (!destinationDir.mkdirs()) {
LOGGER.error("Cannot create directory: {}", destinationDir);
return true;
}

destinationDir.mkdirs();
DicomExportParameters dicomExportParameters = new DicomExportParameters(null, true, null, 0, 0);
dcm.saveToFile(new File(destinationDir, iuid), dicomExportParameters);
return false;
}
}

0 comments on commit 76d5355

Please sign in to comment.