31 #include <itksys/SystemTools.hxx> 32 #include <itksys/Directory.hxx> 48 std::vector<BaseData::Pointer> result;
56 MITK_INFO <<
"it is a Philips3D US Dicom file" << std::endl;
58 std::locale previousCppLocale(std::cin.getloc());
64 stringvec.push_back(fileName);
69 data->GetPropertyList()->SetProperty(
"name", nameProp);
70 result.push_back(data);
72 std::cin.imbue(previousCppLocale);
82 if (relevantFiles.empty())
84 bool pathIsDirectory = itksys::SystemTools::FileIsDirectory(this->
GetLocalFileName());
87 itksys::Directory input;
90 std::vector<std::string> files;
91 for (
unsigned long idx = 0; idx<input.GetNumberOfFiles(); idx++)
93 if (!itksys::SystemTools::FileIsDirectory(input.GetFile(idx)))
95 std::string fullpath = this->
GetLocalFileName() +
"/" + std::string(input.GetFile(idx));
96 files.push_back(fullpath.c_str());
99 relevantFiles = files;
103 if (relevantFiles.empty())
105 MITK_INFO <<
"DICOMReader service found no relevant files in specified location. No data is loaded. Location: "<<fileName;
109 mitk::DICOMFileReader::Pointer reader = this->
GetReader(relevantFiles);
113 MITK_INFO <<
"DICOMReader service found no suitable reader configuration for relevant files.";
117 const unsigned int ntotalfiles = relevantFiles.size();
119 for(
unsigned int i=0; i< ntotalfiles; i++)
126 reader->SetInputFiles(relevantFiles);
129 scanner->AddTagPaths(reader->GetTagsOfInterest());
130 scanner->SetInputFiles(relevantFiles);
133 reader->SetTagCache(scanner->GetScanCache());
134 reader->AnalyzeInputFiles();
135 reader->LoadImages();
137 for (
unsigned int i = 0; i < reader->GetNumberOfOutputs(); ++i)
145 data->SetProperty(
"name", nameProp);
147 result.push_back(data);
161 return relevantFiles;
177 return abstractConfidence;
185 if (studyProp.IsNotNull())
187 nodeName = studyProp->GetValueAsString();
192 if (seriesProp.IsNotNull())
194 if (studyProp.IsNotNull())
203 nodeName += seriesProp->GetValueAsString();
DICOMTagPathMapType MITKDICOMREADER_EXPORT GetCurrentDICOMTagsOfInterest()
ConfidenceLevel GetConfidenceLevel() const override
The confidence level of the reader or writer implementation.
std::vector< itk::SmartPointer< BaseData > > Read() override
DICOMFilePathList GetDICOMFilesInSameDirectory(const std::string &filePath)
std::vector< std::string > StringContainer
Lists of filenames.
std::string MITKCORE_EXPORT GeneratePropertyNameForDICOMTag(unsigned int group, unsigned int element)
Image::Pointer GetMitkImage() const
the 3D mitk::Image that is loaded from the DICOM files of a DICOMImageFrameList
static DataNode::Pointer LoadDicomSeries(const StringContainer &filenames, bool sort=true, bool load4D=true, bool correctGantryTilt=true, UpdateCallBackMethod callback=nullptr, itk::SmartPointer< Image > preLoadedImageBlock=nullptr)
DataCollection - Class to facilitate loading/accessing structured data.
virtual BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const =0
Get property by its key.
virtual mitk::DICOMFileReader::Pointer GetReader(const mitk::StringList &relevantFiles) const =0
std::vector< std::string > m_ReadFiles
MITKDICOMREADER_EXPORT mitk::BaseProperty::Pointer GetDICOMPropertyForDICOMValuesFunctor(const DICOMCachedValueLookupTable &cacheLookupTable)
BaseDICOMReaderService(const std::string &description)
static std::string NO_NAME_VALUE()
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
std::string GetLocalFileName() const
Get a local file name for reading.
ConfidenceLevel
A confidence level describing the confidence of the reader or writer in handling the given data...
Convenience class to temporarily change the current locale.
Output descriptor for DICOMFileReader.
IFileReader::ConfidenceLevel GetConfidenceLevel() const override
The confidence level of the reader or writer implementation.
std::string MITKDICOMREADER_EXPORT GenerateNameFromDICOMProperties(const mitk::IPropertyProvider *provider)
mitk::StringList GetRelevantFiles() const
static bool IsPhilips3DDicom(const std::string &filename)
Checks if a specific file is a Philips3D ultrasound DICOM file.
std::vector< std::string > StringList
Base class for creating mitk::BaseData objects from files or streams.
std::string GetInputLocation() const override
Get the current input location.