Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
mitkSimpleVolumeDICOMSeriesReaderService.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
16 
17 #include <usModuleContext.h>
18 #include <usModuleResource.h>
19 #include <usGetModuleContext.h>
20 #include <usModuleResourceStream.h>
21 #include <usModule.h>
22 #include <usModuleRegistry.h>
23 
24 namespace mitk {
25 
27  : BaseDICOMReaderService("MITK Simple 3D Volume Importer")
28 {
29  this->RegisterService();
30 }
31 
32 DICOMFileReader::Pointer SimpleVolumeDICOMSeriesReaderService::GetReader(const mitk::StringList& relevantFiles) const
33 {
34  mitk::StringList files = relevantFiles;
35  std::string descr;
36 
37  us::ModuleResource resource =
38  us::ModuleRegistry::GetModule("MitkDICOMReader")->GetResource("configurations/3D/simpleinstancenumber_soft.xml");
39 
40  if ( resource.IsValid() )
41  {
42  us::ModuleResourceStream stream(resource);
43 
44  stream.seekg(0, std::ios::end);
45  descr.reserve(stream.tellg());
46  stream.seekg(0, std::ios::beg);
47 
48  descr.assign((std::istreambuf_iterator<char>(stream)),
49  std::istreambuf_iterator<char>());
50  }
51 
52  DICOMReaderConfigurator::Pointer configurator = DICOMReaderConfigurator::New();
53  DICOMFileReader::Pointer reader = configurator->CreateFromUTF8ConfigString(descr);
54 
55  return reader.GetPointer();
56 };
57 
58 
59  SimpleVolumeDICOMSeriesReaderService* SimpleVolumeDICOMSeriesReaderService::Clone() const
60  {
61  return new SimpleVolumeDICOMSeriesReaderService(*this);
62  }
63 
64 }
mitk::DICOMFileReader::Pointer GetReader(const mitk::StringList &relevantFiles) const override
static Module * GetModule(long id)
DataCollection - Class to facilitate loading/accessing structured data.
us::ServiceRegistration< IFileReader > RegisterService(us::ModuleContext *context=us::GetModuleContext())
ModuleResource GetResource(const std::string &path) const
Definition: usModule.cpp:267
std::vector< std::string > StringList