7 #include "fwPacsIO/helper/Series.hpp" 8 #include "fwPacsIO/exceptions/TagMissing.hpp" 11 #include <fwMedData/DicomSeries.hpp> 12 #include <fwMedData/Equipment.hpp> 13 #include <fwMedData/ImageSeries.hpp> 14 #include <fwMedData/ModelSeries.hpp> 15 #include <fwMedData/Patient.hpp> 16 #include <fwMedData/Study.hpp> 18 #include <boost/foreach.hpp> 27 while (!responses.empty())
29 delete responses.front();
30 responses.pop_front();
38 DicomSeriesContainer seriesContainer;
40 OFIterator< QRResponse* > it;
44 for (it = responses.begin(); it != responses.end(); ++it)
47 if ((*it)->m_dataset != NULL)
52 ::fwMedData::DicomSeries::sptr series = ::fwMedData::DicomSeries::New();
53 ::fwMedData::Patient::sptr patient = ::fwMedData::Patient::New();
54 ::fwMedData::Study::sptr study = ::fwMedData::Study::New();
55 ::fwMedData::Equipment::sptr equipment = ::fwMedData::Equipment::New();
58 series->setPatient(patient);
59 series->setStudy(study);
60 series->setEquipment(equipment);
66 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesInstanceUID, data);
67 series->setInstanceUID(data.c_str());
69 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_Modality, data);
70 series->setModality(data.c_str());
72 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesDate, data);
73 series->setDate(data.c_str());
75 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesTime, data);
76 series->setTime(data.c_str());
78 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesDescription, data);
79 series->setDescription(data.c_str());
81 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_PerformingPhysicianName, data);
82 ::fwMedData::DicomValuesType performingPhysiciansName;
83 performingPhysiciansName.push_back(data.c_str());
84 series->setPerformingPhysiciansName(performingPhysiciansName);
89 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_PatientName, data);
90 patient->setName(data.c_str());
92 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_PatientID, data);
93 patient->setPatientId(data.c_str());
95 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_PatientBirthDate, data);
96 patient->setBirthdate(data.c_str());
98 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_PatientSex, data);
99 patient->setSex(data.c_str());
105 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_StudyInstanceUID, data);
106 study->setInstanceUID(data.c_str());
108 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_StudyDate, data);
109 study->setDate(data.c_str());
111 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_StudyTime, data);
112 study->setTime(data.c_str());
114 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_ReferringPhysicianName, data);
115 study->setReferringPhysicianName(data.c_str());
117 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_StudyDescription, data);
118 study->setDescription(data.c_str());
120 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_PatientAge, data);
121 study->setPatientAge(data.c_str());
126 (*it)->m_dataset->findAndGetOFStringArray(DCM_InstitutionName, data);
127 equipment->setInstitutionName(data.c_str());
134 long int nbinstances;
135 (*it)->m_dataset->findAndGetLongInt(DCM_NumberOfSeriesRelatedInstances, nbinstances);
136 series->setNumberOfInstances(nbinstances);
139 seriesContainer.push_back(series);
145 return seriesContainer;
152 InstanceUIDContainer result;
154 for(const ::fwMedData::Series::sptr& s: series )
156 result.push_back(s->getInstanceUID());
166 InstanceUIDContainer instanceUIDContainer;
168 OFIterator< QRResponse* > it;
172 for (it = responses.begin(); it != responses.end(); ++it)
175 if ((*it)->m_dataset != NULL)
177 OFString seriesInstanceUID;
178 result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesInstanceUID, seriesInstanceUID);
182 instanceUIDContainer.push_back(seriesInstanceUID.c_str());
186 const std::string msg =
"There is no \"SeriersInstanceUID\" tag in the selected series :" 187 + std::string(result.text());
188 throw ::fwPacsIO::exceptions::TagMissing(msg);
194 return instanceUIDContainer;
static FWPACSIO_API DicomSeriesContainer toFwMedData(OFList< QRResponse * > responses)
Convert DCMTK series to fwMedData::DicomSeries.
fwPacsIO contains classes used to communicate with a PACS.
static FWPACSIO_API InstanceUIDContainer toSeriesInstanceUIDContainer(OFList< QRResponse * > responses)
Convert DCMTK series to instance uid vector.
This file defines SpyLog macros. These macros are used to log messages to a file or to the console du...
static FWPACSIO_API void releaseResponses(OFList< QRResponse * > responses)
Release the responses.