start and stop dicom receiver using DcmRcv class

489 views
Skip to first unread message

Thanasis Iliopoulos

unread,
Sep 29, 2014, 7:45:20 PM9/29/14
to dcm...@googlegroups.com

Hello guys,

i am really new to DICOM and dcm4che so i am a bit struggling on how to get things work together.

Here is the full scenario i would like to implement:

I would like to implement a DICOM listener (server) which will accept DICOM sent requests by a DICOM client (e.g. an MRI) ... 
From the moment that i will have dicom series/images saved locally, i should anonymize them, compress them to zip format and send them via https (secured soap) over the network.

So the fist part is implementing a DICOM listener

I have built a simple gui with two buttons (start/stop listener) and a log file (showing the listener status). 

I want to implement three java methods for starting dicom listener, stopping dicom listener and checking its status.

I have also noticed that DcmRcv is actually an already implemented DICOM listener so i am trying to use its interface for starting/stopping the listener as follows:

//my GUI controller class
public class FXMLDocumentController implements Initializable {
...
private DcmRcv dcmRcv;
private Boolean dcmRcvStatus;
...
 public void initialize() {
... 
dcmRcv = new DcmRcv();
dcmRcvStatus = null;
... 
//call method to check status "checkDcmrcvService"
// if listener dcmRcv is down, start it!
 
}

public void startDcmrcvService (ActionEvent event) {
        System.out.println("Going to start DICOM receiver service");
        try {            
            dcmRcv.setAEtitle("DCM4CHE1");
            dcmRcv.setHostname("127.0.0.1");
            dcmRcv.setPort(435);
            dcmRcv.setDestination("C:\\yyy\\xxx\\Development\\DevDir");
            dcmRcv.start();
        } catch (IOException ex) {
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.ALL, null, ex);
        }
    }
    
    public void stopDcmrcvService (ActionEvent event) {
       System.out.println("Going to stop DICOM receiver service");        
       this.dcmRcv.stop();   
        
    }
    
    public boolean checkDcmrcvService () {
        System.out.println("Going to check DICOM receiver service");
        // ...
        // IMPLEMENT LOGIC ON HOW TO CHECK listener status
        // ...
        return dcmRcvStatus;
    } 
...

I can start/stop DcmRcv from the command line and verify its status successfully by using Mayam client. I am starting listener as: dcmrcv DCM4...@127.0.0.1:435

I am trying to achieve the same with the code listed in method "startDcmrcvService" but i think something is going wrong! I can not verify the connection via Mayam (using the exact AETitle@hostname:port) ...

Any ideas on what i have been missing?

And a last question! Does DcmRcv provides any methods on checking listener status? How am i going to check its status?

Any help would be really useful since i would like to move on fast with this project and DICOM/dcm4che seems to require a lot of digging ...

Thanks!

Thanasis Iliopoulos

unread,
Sep 30, 2014, 10:05:21 AM9/30/14
to dcm...@googlegroups.com
After some trials i have successfully started the dicom listener from within my GUI controller class:

...
setDcmRcv(new DcmRcv("device"));
        setDcmRcvStatus(null);
        checkDcmrcvService();
        if(dcmRcvStatus.equals(false)) {
            System.out.println("Receiver is down. Going to start it!");
            startDcmrcvService();
        }

public void startDcmrcvService (ActionEvent event) {
        System.out.println("Going to start DICOM receiver service");
        try {            
            getDcmRcv().setAEtitle("DCM4CHE1");
            getDcmRcv().setHostname("127.0.0.1");
            getDcmRcv().setPort(435);
            getDcmRcv().setDestination("C:\\forth\\npap\\Development\\DevDir");
            getDcmRcv().initTransferCapability();
            getDcmRcv().start();          
        } catch (IOException ex) {
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.ALL, null, ex);
        }
    }
public void stopDcmrcvService (ActionEvent event) {
       System.out.println("Going to stop DICOM receiver service");
       this.dcmRcv.stop();
       //getDcmRcv().stop();   
        
    }
    
    public boolean checkDcmrcvService () {
        System.out.println("Going to check DICOM receiver service");
        setDcmRcvStatus(false);        
        DcmEcho dcmEcho = new DcmEcho("device");
        dcmEcho.setRemoteHost("127.0.0.1");
        dcmEcho.setRemotePort(435);
        dcmEcho.setCalledAET("DCM4CHE1", true);
        
        try {
            dcmEcho.open();
            setDcmRcvStatus(true);
            System.out.println("Listener is up and running");
            dcmEcho.close();
        } catch (IOException ex) {
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.ALL, null, ex);
        } catch (ConfigurationException ex) {
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.ALL, null, ex);
        } catch (InterruptedException ex) {
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.ALL, null, ex);
        }
        
        return dcmRcvStatus;
    }
....
Reply all
Reply to author
Forward
0 new messages