| 292 | |
| 293 | |
| 294 | std::vector<itk::SmartPointer<BaseData> > BaseDICOMReaderService::DoRead() |
| 295 | { |
| 296 | std::vector<BaseData::Pointer> result; |
| 297 | |
| 298 | |
| 299 | const std::string fileName = this->GetLocalFileName(); |
| 300 | //special handling of Philips 3D US DICOM. |
| 301 | //Copied from DICOMSeriesReaderService |
| 302 | if (DicomSeriesReader::IsPhilips3DDicom(fileName)) |
| 303 | { |
| 304 | MITK_INFO << "it is a Philips3D US Dicom file" << std::endl; |
| 305 | mitk::LocaleSwitch localeSwitch("C"); |
| 306 | std::locale previousCppLocale(std::cin.getloc()); |
| 307 | std::locale l("C"); |
| 308 | std::cin.imbue(l); |
| 309 | |
| 310 | DataNode::Pointer node = DataNode::New(); |
| 311 | mitk::DicomSeriesReader::StringContainer stringvec; |
| 312 | stringvec.push_back(fileName); |
| 313 | if (DicomSeriesReader::LoadDicomSeries(stringvec, *node)) |
| 314 | { |
| 315 | BaseData::Pointer data = node->GetData(); |
| 316 | StringProperty::Pointer nameProp = StringProperty::New(itksys::SystemTools::GetFilenameName(fileName)); |
| 317 | data->GetPropertyList()->SetProperty("name", nameProp); |
| 318 | result.push_back(data); |
| 319 | } |
| 320 | std::cin.imbue(previousCppLocale); |
| 321 | return result; |
| 322 | } |
| 323 | |
| 324 | //Normal DICOM handling (It wasn't a Philips 3D US) |
| 325 | mitk::StringList relevantFiles = this->GetDICOMFilesInSameDirectory(); |
| 326 | |
| 327 | if (relevantFiles.empty()) |
| 328 | { |
| 329 | MITK_INFO << "DICOMReader service found no relevant files in specified location. No data is loaded. Location: "<<fileName; |
| 330 | } |
| 331 | else |
| 332 | { |
| 333 | bool pathIsDirectory = itksys::SystemTools::FileIsDirectory(fileName); |
| 334 | |
| 335 | if (!pathIsDirectory && m_OnlyRegardOwnSeries) |
| 336 | { |
| 337 | relevantFiles = mitk::FilterDICOMFilesForSameSeries(fileName, relevantFiles); |
| 338 | } |
| 339 | |
| 340 | mitk::DICOMFileReader::Pointer reader = this->GetReader(relevantFiles); |
| 341 | |
| 342 | if(reader.IsNull()) |
| 343 | { |
| 344 | MITK_INFO << "DICOMReader service found no suitable reader configuration for relevant files."; |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | if (!pathIsDirectory) |
| 349 | { //we ensure that we only load the relevant image block files |
| 350 | const auto nrOfOutputs = reader->GetNumberOfOutputs(); |
| 351 | for (unsigned int outputIndex = 0; outputIndex < nrOfOutputs; ++outputIndex) |
nothing calls this directly
no test coverage detected