Skip to content

Commit fc48f30

Browse files
committed
allow ignoring SRAnonTool if explicitly specified
1 parent eba131f commit fc48f30

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Required arguments:
1919
can be found
2020
[here](https://github.com/johnperry/CTP/tree/master/source/files/profiles/dicom)
2121
- `-s` / `--sr-anon-tool`: Path to the
22-
[SRAnonTool](https://github.com/SMI/SmiServices/tree/master/src/applications/SRAnonTool)
22+
[SRAnonTool](https://github.com/SMI/SmiServices/tree/master/src/applications/SRAnonTool). Can be set to `false` if SR anonymisation is being performed elsewhere.
2323

2424
Optional arguments:
2525

src/main/java/uk/ac/ed/epcc/ctp_anon_cli/Program.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ public static void main(String[] args) throws ParseException {
6161
"Cannot find anonymisation script file"
6262
);
6363

64-
File srAnonTool = new File(Paths.get(cli.getOptionValue("s")).toString());
65-
if (!srAnonTool.isFile()) throw new IllegalArgumentException(
66-
"Cannot find SRAnonTool"
67-
);
64+
File srAnonTool = null;
65+
String srAnonToolPath = cli.getOptionValue("s");
66+
if (!srAnonToolPath.toLowerCase().equals("false")) {
67+
srAnonTool = new File(Paths.get(srAnonToolPath).toString());
68+
if (!srAnonTool.isFile()) {
69+
throw new IllegalArgumentException("Cannot find SRAnonTool");
70+
}
71+
}
6872

6973
List<String> files = cli.getArgList();
7074
boolean runAsDaemon = false;

src/main/java/uk/ac/ed/epcc/ctp_anon_cli/SmiCtpProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void anonymizeImpl(File inFile, File outFile) throws Exception {
129129
}
130130

131131
// Structured Reports have an additional anonymisation step
132-
if (!isSR) return;
132+
if (!isSR || _srAnonTool == null) return;
133133

134134
String commandArray[] = {
135135
_srAnonTool.getAbsolutePath(),

0 commit comments

Comments
 (0)