DcmSCPPool's AETitle

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

DcmSCPPool's AETitle

#1 Post by martinrame »

Hi, I created an inherited DcmThreadSCP class called DicomSCP I instantiate in a pool this way:

Code: Select all

DcmSCPPool<DicomSCP> pool;
DcmSCPConfig& config = pool.getConfig();
config.setAETitle(lAETitle);
config.setPort(lPort);
config.setConnectionBlockingMode(DUL_NOBLOCK);
// more configs
pool.listen()
Now, if I want to get the SCP's aetitle from my DicomSCP constructor I get DCMTK_SCP and not the aetitle I've set with setAETitle. I know I can get the correct AETitle from DicomSCP.handleIncomingCommand, but, is there a way to get the aetitle from outside that method?.

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: DcmSCPPool's AETitle

#2 Post by Jan Schlamelcher »

It has been some time since I wrote that code ;-). I think you'll have to get the AE title from the config after it has been initialized instead of in the constructor, i.e. override DcmThreadSCP::setSharedConfig().

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: DcmSCPPool's AETitle

#3 Post by Michael Onken »

Hi,

I'm not sure that I understand the issue a 100%. Can you extend the example in a way that demonstrates how the getAETitle() call returns the wrong AE title?

Thanks,
Michael

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

Re: DcmSCPPool's AETitle

#4 Post by martinrame »

Jan Schlamelcher wrote:It has been some time since I wrote that code ;-). I think you'll have to get the AE title from the config after it has been initialized instead of in the constructor, i.e. override DcmThreadSCP::setSharedConfig().
Great, now, how can I access the config from within my worker?.

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: DcmSCPPool's AETitle

#5 Post by Jan Schlamelcher »

The DcmThreadSCP::setSharedConfig() method get's it as a parameter?! Make sure to pass it to the base method into your overrided one, so it can be used afterwards using getSharedConfig().

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

Re: DcmSCPPool's AETitle

#6 Post by martinrame »

Jan Schlamelcher wrote:The DcmThreadSCP::setSharedConfig() method get's it as a parameter?! Make sure to pass it to the base method into your overrided one, so it can be used afterwards using getSharedConfig().
Let me try to understand what you mean.

I'm invoking my DicomSCP class through a DcmSCPPool this way:

Code: Select all

DcmSCPPool<DicomSCP> pool;
DcmSCPConfig& config = pool.getConfig();
config.setAETitle(lAETitle);
config.setPort(lPort);
config.setConnectionBlockingMode(DUL_NOBLOCK);
// more configs
pool.listen()
My DicomSCP definition is this:

Code: Select all

class DicomSCP: public DcmThreadSCP {
  public:
    DicomSCP();
    ~DicomSCP(); 
  private:
    OFCondition handleIncomingCommand(T_DIMSE_Message *incomingMsg, 
      const DcmPresentationContextInfo &presContextInfo);
};
Should I override a setSharedConfig in my class?, how can I tell the pool to pass that config to the worker?.

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: DcmSCPPool's AETitle

#7 Post by Jan Schlamelcher »

martinrame wrote:Should I override a setSharedConfig in my class?
Yes, override it in DicomSCP:

Code: Select all

class DicomSCP: public DcmThreadSCP {
  public:
    DicomSCP();
    ~DicomSCP();
  private:
    OFCondition handleIncomingCommand(T_DIMSE_Message *incomingMsg,
      const DcmPresentationContextInfo &presContextInfo);

    OFCondition setSharedConfig( const DcmSharedSCPConfig& config )
    {
        // do whatever you need with the config
        return DcmThreadSCP::setSharedConfig( config );
    }
};
martinrame wrote:how can I tell the pool to pass that config to the worker?.
You don't, it always does this:

Code: Select all

201       DcmBaseSCPWorker* const worker = createSCPWorker();
202       if (!worker) /* Oops, we cannot allocate a new worker thread */
203       {
204         result = EC_MemoryExhausted;
205       }
206       else /* Configure worker thread */
207       {
208         m_workersBusy.push_back(worker);
209         worker->setSharedConfig(sharedConfig);
210         chosen = worker;
211       }

martinrame
Posts: 347
Joined: Mon, 2009-02-23, 19:57

Re: DcmSCPPool's AETitle

#8 Post by martinrame »

Thanks Jan!, it worked as expected.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest