21 #define QT_NO_CAST_TO_ASCII 23 #include <dcmtk/dcmdata/dcdeftag.h> 24 #include <dcmtk/dcmdata/dcelem.h> 26 #include "dcmtk/dcmnet/dfindscu.h" 59 static const OFString Patient (
"PATIENT" );
63 if ( !d->
dcmObject->findAndGetElements ( DCM_Item, itemsTmp ).good() ) {
67 while ( itemsTmp.card() > 0 ) {
76 OFCondition condition = lobj->findAndGetElements ( DCM_DirectoryRecordType, dirent );
78 if ( !condition.good() ) {
83 while ( dirent.card() ) {
84 DcmElement* elt = ( DcmElement* ) dirent.top();
86 elt->getOFStringArray ( cur );
87 if ( cur == Patient ) {
89 QMap<QString, QString> infosMap;
90 if ( lobj->findAndGetElement ( DCM_PatientName, lelt ).good() ){
92 lelt->getOFStringArray ( strName );
93 infosMap.insert (
"Name", QString ( strName.c_str() ) );
96 if ( lobj->findAndGetElement ( DCM_PatientID, lelt ).good() ){
98 lelt->getOFStringArray ( strID );
99 infosMap.insert (
"ID", QString ( strID.c_str() ) );
102 if ( lobj->findAndGetElement ( DCM_PatientBirthDate, lelt ).good() ){
104 lelt->getOFStringArray ( strBirth );
105 infosMap.insert (
"Birthdate", QString ( strBirth.c_str() ) );
108 if ( lobj->findAndGetElement ( DCM_PatientSex, lelt ).good() ) {
110 lelt->getOFStringArray ( strSex );
111 infosMap.insert (
"Sex", QString ( strSex.c_str() ) );
128 bool proceed =
false;
129 static const OFString Patient (
"PATIENT" );
130 static const OFString Study (
"STUDY" );
134 if ( !d->
dcmObject->findAndGetElements ( DCM_Item, itemsTmp ).good() ) {
138 while ( itemsTmp.card() > 0 ){
147 OFCondition condition = lobj->findAndGetElements ( DCM_DirectoryRecordType, dirent );
148 if ( !condition.good() ) {
153 while ( dirent.card() ) {
154 DcmElement* elt = ( DcmElement* ) dirent.top();
156 elt->getOFStringArray ( cur );
158 if ( cur == Patient ){
160 if ( lobj->findAndGetElement ( DCM_PatientName, lelt ).good() ) {
162 lelt->getOFStringArray ( strName );
163 proceed = ( QString ( strName.c_str() ) == patientName );
167 if ( ( cur == Study ) && proceed ){
169 QMap<QString, QString> infosMap;
170 if ( lobj->findAndGetElement ( DCM_StudyInstanceUID, lelt ).good() ) {
172 lelt->getOFStringArray ( strUID );
173 infosMap.insert (
"UID", QString ( strUID.c_str() ) );
176 if ( lobj->findAndGetElement ( DCM_StudyID, lelt ).good() ) {
178 lelt->getOFStringArray ( strID );
179 infosMap.insert (
"ID", QString ( strID.c_str() ) );
182 if ( lobj->findAndGetElement ( DCM_StudyDescription, lelt ).good() ) {
183 OFString strDescription;
184 lelt->getOFStringArray ( strDescription );
185 infosMap.insert (
"Description", QString ( strDescription.c_str() ) );
188 if ( lobj->findAndGetElement ( DCM_StudyDate, lelt ).good() ) {
190 lelt->getOFStringArray ( strDate );
191 infosMap.insert (
"Date", QString ( strDate.c_str() ) );
207 bool proceed =
false;
208 static const OFString Patient (
"PATIENT" );
209 static const OFString Study (
"STUDY" );
210 static const OFString Series (
"SERIES" );
214 if ( !d->
dcmObject->findAndGetElements ( DCM_Item, itemsTmp ).good() ) {
218 while ( itemsTmp.card() > 0 ) {
232 OFCondition condition = lobj->findAndGetElements ( DCM_DirectoryRecordType, dirent );
234 if ( !condition.good() ) {
239 while ( dirent.card() ) {
240 DcmElement* elt = ( DcmElement* ) dirent.top();
242 elt->getOFStringArray ( cur );
244 if ( cur == Patient ) {
246 if ( lobj->findAndGetElement ( DCM_PatientName, lelt ).good() )
247 lelt->getOFStringArray ( strName );
250 if ( cur == Study ) {
252 if ( lobj->findAndGetElement ( DCM_StudyInstanceUID, lelt ).good() ) {
254 lelt->getOFStringArray ( strUid );
255 proceed = ( ( QString ( strName.c_str() ) == patientName ) && ( QString ( strUid.c_str() ) == studyUid ) );
258 if ( lobj->findAndGetElement ( DCM_StudyDate, lelt ).good() ) {
259 lelt->getOFStringArray ( strDate );
263 if ( ( cur == Series ) && proceed ) {
265 QMap<QString, QString> infosMap;
267 if ( lobj->findAndGetElement ( DCM_SeriesInstanceUID, lelt ).good() ) {
269 lelt->getOFStringArray ( strID );
270 infosMap.insert (
"ID", QString ( strID.c_str() ) );
273 if ( lobj->findAndGetElement ( DCM_SeriesDescription, lelt ).good() ) {
274 OFString strDescription;
275 lelt->getOFStringArray ( strDescription );
276 infosMap.insert (
"Description", QString ( strDescription.c_str() ) );
279 if ( lobj->findAndGetElement ( DCM_Modality, lelt ).good() ) {
280 OFString strModality;
281 lelt->getOFStringArray ( strModality );
282 infosMap.insert (
"Modality", QString ( strModality.c_str() ) );
285 if ( lobj->findAndGetElement ( DCM_InstitutionName, lelt ).good() ) {
286 OFString strInstitution;
287 lelt->getOFStringArray ( strInstitution );
288 infosMap.insert (
"Institution", QString ( strInstitution.c_str() ) );
291 if ( lobj->findAndGetElement ( DCM_AcquisitionNumber, lelt ).good() ) {
293 lelt->getOFStringArray ( strCount );
294 infosMap.insert (
"InstanceCount", QString ( strCount.c_str() ) );
297 if ( lobj->findAndGetElement ( DCM_PerformingPhysicianName, lelt ).good() ) {
298 OFString strOperator;
299 lelt->getOFStringArray ( strOperator );
300 infosMap.insert (
"Operator", QString ( strOperator.c_str() ) );
303 infosMap.insert (
"Date", QString ( strDate.c_str() ) );
319 bool proceed =
false;
320 static const OFString Series (
"SERIES" );
321 static const OFString Image (
"IMAGE" );
325 if ( !d->
dcmObject->findAndGetElements ( DCM_Item, itemsTmp ).good() ) {
329 while ( itemsTmp.card() > 0 ) {
340 OFCondition condition = lobj->findAndGetElements ( DCM_DirectoryRecordType, dirent );
342 if ( !condition.good() ) {
347 while ( dirent.card() ) {
348 DcmElement* elt = ( DcmElement* ) dirent.top();
350 elt->getOFStringArray ( cur );
352 if ( cur == Series ) {
354 if ( lobj->findAndGetElement ( DCM_SeriesInstanceUID, lelt ).good() ) {
356 lelt->getOFStringArray ( strID );
357 proceed = ( QString ( strID.c_str() ) == seriesUID );
361 if ( ( cur == Image ) && proceed ) {
365 OFString strNumber (
"0" );
366 if ( lobj->findAndGetElement ( DCM_InstanceNumber, lelt ).good() )
367 lelt->getOFStringArray ( strNumber );
369 if ( lobj->findAndGetElement ( DCM_ReferencedSOPInstanceUIDInFile, lelt ).good() ) {
370 lelt->getOFStringArray ( strUID );
static QtDcmManager * instance()
void findImages(const QString &seriesUID)
void foundSerie(const QMap< QString, QString > &infosMap)
void foundPatient(const QMap< QString, QString > &infosMap)
virtual ~QtDcmFindDicomdir()
QtDcmFindDicomdir(QObject *parent=0)
void setDcmItem(DcmItem *item)
void findStudies(const QString &patientName)
void findSeries(const QString &patientName, const QString &studyUid)
void foundStudy(const QMap< QString, QString > &infosMap)
void foundImage(const QString &image, int number)