no FINDResponses class in scu.h of snapshot 3.6.1

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ahirnish
Posts: 38
Joined: Wed, 2012-01-04, 10:18

no FINDResponses class in scu.h of snapshot 3.6.1

#1 Post by ahirnish »

FINDResponses was a class defined in the dcmnet/scu.h of the official first release og 3.6.0 but sendMOVERequest wasnt.
As per the instructions at the end of howto, I used the snapshot 3.6.1 to include sendMOVERequest handler but there is no FINDResponses class in the new scu.h

So, the code on howto page is giving errors.
Suggestions please?

Thank You.

Shaeto
Posts: 147
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

#2 Post by Shaeto »

do not use snapshots ?:)

J. Riesmeier
DCMTK Developer
Posts: 2517
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#3 Post by J. Riesmeier »

Reading the API documentation might also help :-)

The class FINDResponses has been converted into "OFList <QRResponse *>".

ahirnish
Posts: 38
Joined: Wed, 2012-01-04, 10:18

#4 Post by ahirnish »

Sir,
After reading and comparing the APIs of both scu.h, I guessed that much but the method numResults(), which was initially declared in the FINDResponses class is not available in the snapshot. What should I do to replace that method?

Also, is QRResponse class exactly analogous to FINDResponses class? I mean should I replace FINDResponses class declaration with QRResponse class in the code?

ahirnish
Posts: 38
Joined: Wed, 2012-01-04, 10:18

#5 Post by ahirnish »

Hi Shaeto,

Why shouldnt I use the snapshots?

Shaeto
Posts: 147
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

#6 Post by Shaeto »

thats okay you can use it but this requires to read sources instead of documentation, especially for experimental things like new SCP/SCU classes, thanks to dcmtk team code is very readable.

ahirnish
Posts: 38
Joined: Wed, 2012-01-04, 10:18

#7 Post by ahirnish »

Mr. Riesmeier,
After reading and comparing the APIs of both scu.h, I guessed that much but the methods such as numResults(), which was initially declared in the FINDResponses class is not available in the snapshot. What should I do to replace those methods?

Also, is QRResponse class exactly analogous to FINDResponses class? I mean should I replace FINDResponses class declaration with QRResponse class in the code?

Shaeto
Posts: 147
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

#8 Post by Shaeto »

If there is OFList <...> you can use OFList::size() method to get actual number of responses and numResults if this case is unnecessary

ahirnish
Posts: 38
Joined: Wed, 2012-01-04, 10:18

#9 Post by ahirnish »

Hi Shaeto,

What i did is that I copied FINDResponse class declaration and definition in the snapshot's scu.h so that there shouldn't be any problem.
Main problem is that : last parameter of sendMOVERequest is of type OFList<QRResponse*> (in the snapshot scu.h), so I created an instance of this class and passed it to the sendMOVERequest method but every other thing in the code is referenced via FINDResponse instance.

Initially, the last parameter of sendMOVERequest is of type FINDResponses*. My problem is that although I created an instance of OFList<QRResponse*> type but this instance finds its utility only in the parameter (so as to avoid typecasting error) and nowhere. Will it work?

I am posting my code snippet for your better understanding. I just wanted to run that sample code of DCMScu.

Code: Select all

/* Assemble and send C-FIND request */ 
  FINDResponses findResponses; 
  OFList<QRResponse*> qrresponse;
  DcmDataset req; 
  req.putAndInsertOFStringArray(DCM_QueryRetrieveLevel, "STUDY"); 
  req.putAndInsertOFStringArray(DCM_StudyInstanceUID, ""); 
  T_ASC_PresentationContextID presID = findUncompressedPC(UID_FINDStudyRootQueryRetrieveInformationModel, scu);
  if (presID == 0) 
  { 
    DCMNET_ERROR("There is no uncompressed presentation context for Study Root FIND"); 
    return 1; 
  } 
  result = scu.sendFINDRequest(presID, &req, &qrresponse); 
  if (result.bad()) 
    return 1; 
  else 
    DCMNET_INFO("There are " << findResponses.numResults() << " studies available"); 
 
  /* Assemble and send C-MOVE request, for each study identified above*/ 
  presID = findUncompressedPC(UID_MOVEStudyRootQueryRetrieveInformationModel, scu); 
  if (presID == 0) 
  { 
    DCMNET_ERROR("There is no uncompressed presentation context for Study Root MOVE"); 
    return 1; 
  } 
  OFListIterator(FINDResponse*) study = findResponses.begin(); 
  Uint32 studyCount = 1; 
  OFBool failed = OFFalse; 
  while (study != findResponses.end() && result.good()) 
  { 
    // Every loop run will get all image for a specific study 
    OFList<RetrieveResponse*> retrieveResponses; 
    // be sure we are not in the last response which does not have a dataset 
    if ( (*study)->m_dataset != NULL) 
    { 
      OFString studyInstanceUID; 
      result = (*study)->m_dataset->findAndGetOFStringArray(DCM_StudyInstanceUID, studyInstanceUID); 
      // only try to get study if we actually have study instance uid, otherwise skip it 
      if (result.good()) 
      { 
        req.putAndInsertOFStringArray(DCM_StudyInstanceUID, studyInstanceUID); 
        // fetches all images of this particular study 
        result = scu.sendMOVERequest(presID, MOVEAPPLICATIONTITLE, &req, &retrieveResponses); 
        if (result.good()) 
        { 
          DCMNET_INFO("Received study #" << std::setw(7) << studyCount << ": " << studyInstanceUID); 
          studyCount++; 
        } 
      } 
    } 
    study++; 
  } 
  if (result.bad()) 
  { 
    DCMNET_ERROR("Unable to retrieve all studies: " << result.text()); 
  } 
  /* Release association */ 
  scu.closeAssociation(DCMSCU_RELEASE_ASSOCIATION); 
  return 0; 
}

Shaeto
Posts: 147
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

#10 Post by Shaeto »

hmmm

actually i don't see FINDResponses class in last snapshot, so, you have to use OFList, for example:

....
OFList<QRResponse*> qrresponse;
......

result = scu.sendFINDRequest(presID, &req, &qrresponse);

if (result.good()) {
// get real number of c-find responses
int num = qrresponse.size();

// now iterate

OFListIterator(OFList<QRResponse*>) first = qrresponse.begin();
OFListIterator(OFList<QRResponse*>) last = qrresponse.end();

while (first != last) {
........
first++;
}
}
....

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

#11 Post by Michael Onken »

Hi,

I will modify the example within the next days so it fits the current code. Sorry for the inconenience -- since the SCU class is or was pretty new and was extended over time, some design decisions were re-considered from practical experience of DCMTK users and the DCMTK team. I will notify in the forum when the example is fixed. Thanks for helping other users, Shaeto.

Best,
Michael

ahirnish
Posts: 38
Joined: Wed, 2012-01-04, 10:18

#12 Post by ahirnish »

Thank You Mr. Onken and if you can post it in a couple of days, i will be able to complete my project on time. I know you are a busy person but i think changes in code is just a matter of time for you.

Also, thanks to you too, Shaeto! :D

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

#13 Post by Michael Onken »

Hey,

FYI: I just fixed the DcmSCU example in the howto section. Hope it works for you.

Best regards,
Michael

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests