Refactoring to provide a programmatic API

59 views
Skip to first unread message

richard....@brainminer.co.uk

unread,
Oct 6, 2016, 5:19:51 AM10/6/16
to dcm4che
I am trying to call the dcm4che utilities such as findscu from java code.
The code has not been designed with an API suitable for programmatic use, it is designed to create an executable.  To call it from code I create a set of strings representing command line parameters and then call the main() method, passing those strings.  The code outputs a set of XML files to disk, which I then parse.
I would strongly prefer to have a java API to call.  For example it could have methods such as setConnectionString(), and it could return an array of objects, or a stream to parse.
For someone who knows the code I suspect this would be pretty easy; you would create a class to do the work, and then main() would parse the settings and pass them to the processor object.   Main would then serialise the result.
But for me it is quite tricky, because the command line parsing is highly integrated with the implementation code.
Can anyone suggest how this can easily be done?
Do other people need this?

Nicolas Roduit

unread,
Oct 7, 2016, 2:05:17 AM10/7/16
to dcm4che
If you need a Java API for the basic DICOM operations based on dcm4che3, you should look at https://github.com/nroduit/weasis-dicom-tools.

The API gives the progression of DICOM transfers and it status. There are examples of use in the test classes.

richard....@brainminer.co.uk

unread,
Oct 7, 2016, 6:02:33 AM10/7/16
to dcm4che
Nicolas,

That looks absolutely ideal, I wish I had found it when I searched for suitable libraries!

Thanks a lot,

Richard
Reply all
Reply to author
Forward
0 new messages