}
@SuppressWarnings("unchecked")
private static String mkkos(CommandLine cl) throws Exception {
printNextStepMessage("Will now generate a Key Object for files in " + cl.getArgList());
final MkKOS mkkos = new MkKOS();
mkkos.setUIDSuffix(cl.getOptionValue("uid-suffix"));
mkkos.setCodes(CLIUtils.loadProperties(
cl.getOptionValue("code-config", "resource:code.properties"),
null));
mkkos.setDocumentTitle(mkkos.toCodeItem(documentTitleOf(cl)));
mkkos.setKeyObjectDescription(cl.getOptionValue("desc"));
mkkos.setSeriesNumber(cl.getOptionValue("series-no", "999"));
mkkos.setInstanceNumber(cl.getOptionValue("inst-no", "1"));
mkkos.setOutputFile(MkKOS.outputFileOf(cl));
mkkos.setNoFileMetaInformation(cl.hasOption("F"));
mkkos.setTransferSyntax(cl.getOptionValue("t", UID.ExplicitVRLittleEndian));
mkkos.setEncodingOptions(CLIUtils.encodingOptionsOf(cl));
DicomFiles.scan(cl.getArgList(), new DicomFiles.Callback() {
@Override
public boolean dicomFile(File f, Attributes fmi,
long dsPos, Attributes ds) {
return mkkos.addInstance(ds);
}
});
System.out.println();
mkkos.writeKOS();
System.out.println(MessageFormat.format(rb.getString("stored"), mkkos.getFname()));
return mkkos.getFname();
}