Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkDICOMITKSeriesGDCMReader.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 
13 //#define MBILOG_ENABLE_DEBUG
14 #define ENABLE_TIMING
15 
16 #include <itkTimeProbesCollectorBase.h>
17 #include <gdcmUIDs.h>
23 
24 itk::MutexLock::Pointer mitk::DICOMITKSeriesGDCMReader::s_LocaleMutex = itk::MutexLock::New();
25 
26 
27 mitk::DICOMITKSeriesGDCMReader::DICOMITKSeriesGDCMReader( unsigned int decimalPlacesForOrientation, bool simpleVolumeImport )
29 , m_FixTiltByShearing(m_DefaultFixTiltByShearing)
30 , m_SimpleVolumeReading( simpleVolumeImport )
31 , m_DecimalPlacesForOrientation( decimalPlacesForOrientation )
32 , m_ExternalCache(false)
33 {
34  this->EnsureMandatorySortersArePresent( decimalPlacesForOrientation, simpleVolumeImport );
35 }
36 
37 
39 : DICOMFileReader( other )
41 , m_SortingResultInProgress( other.m_SortingResultInProgress )
42 , m_Sorter( other.m_Sorter )
45 , m_ReplacedCLocales( other.m_ReplacedCLocales )
46 , m_ReplacedCinLocales( other.m_ReplacedCinLocales )
47 , m_DecimalPlacesForOrientation( other.m_DecimalPlacesForOrientation )
48 , m_TagCache( other.m_TagCache )
49 , m_ExternalCache(other.m_ExternalCache)
50 {
51 }
52 
54 {
55 }
56 
59 {
60  if ( this != &other )
61  {
64  this->m_SortingResultInProgress = other.m_SortingResultInProgress;
65  this->m_Sorter = other.m_Sorter; // TODO should clone the list items
68  this->m_ReplacedCLocales = other.m_ReplacedCLocales;
69  this->m_ReplacedCinLocales = other.m_ReplacedCinLocales;
70  this->m_DecimalPlacesForOrientation = other.m_DecimalPlacesForOrientation;
71  this->m_TagCache = other.m_TagCache;
72  }
73  return *this;
74 }
75 
77 {
78  if ( const auto* otherSelf = dynamic_cast<const Self*>( &other ) )
79  {
80  if ( this->m_FixTiltByShearing == otherSelf->m_FixTiltByShearing
81  && *( this->m_EquiDistantBlocksSorter ) == *( otherSelf->m_EquiDistantBlocksSorter )
82  && ( fabs( this->m_DecimalPlacesForOrientation - otherSelf->m_DecimalPlacesForOrientation ) < eps ) )
83  {
84  // test sorters for equality
85  if ( this->m_Sorter.size() != otherSelf->m_Sorter.size() )
86  return false;
87 
88  auto mySorterIter = this->m_Sorter.cbegin();
89  auto oSorterIter = otherSelf->m_Sorter.cbegin();
90  for ( ; mySorterIter != this->m_Sorter.cend() && oSorterIter != otherSelf->m_Sorter.cend();
91  ++mySorterIter, ++oSorterIter )
92  {
93  if ( !( **mySorterIter == **oSorterIter ) )
94  return false; // this sorter differs
95  }
96 
97  // nothing differs ==> all is equal
98  return true;
99  }
100  else
101  {
102  return false;
103  }
104  }
105  else
106  {
107  return false;
108  }
109 }
110 
112 {
113  this->Modified();
114  m_FixTiltByShearing = on;
115 }
116 
118 {
119  return m_FixTiltByShearing;
120 }
121 
123 {
124  this->Modified();
125  m_EquiDistantBlocksSorter->SetAcceptTwoSlicesGroups( accept );
126 }
127 
129 {
130  return m_EquiDistantBlocksSorter->GetAcceptTwoSlicesGroups();
131 }
132 
134 {
135  unsigned int sortIndex( 1 );
136  for ( auto sorterIter = m_Sorter.cbegin(); sorterIter != m_Sorter.cend(); ++sortIndex, ++sorterIter )
137  {
138  os << "Sorting step " << sortIndex << ":" << std::endl;
139  ( *sorterIter )->PrintConfiguration( os, " " );
140  }
141 
142  os << "Sorting step " << sortIndex << ":" << std::endl;
143  m_EquiDistantBlocksSorter->PrintConfiguration( os, " " );
144 }
145 
146 
148 {
149  return setlocale( LC_NUMERIC, nullptr );
150 }
151 
153 {
154  s_LocaleMutex->Lock();
155 
156  std::string currentCLocale = setlocale( LC_NUMERIC, nullptr );
157  m_ReplacedCLocales.push( currentCLocale );
158  setlocale( LC_NUMERIC, "C" );
159 
160  std::locale currentCinLocale( std::cin.getloc() );
161  m_ReplacedCinLocales.push( currentCinLocale );
162  std::locale l( "C" );
163  std::cin.imbue( l );
164 
165  s_LocaleMutex->Unlock();
166 }
167 
169 {
170  s_LocaleMutex->Lock();
171 
172  if ( !m_ReplacedCLocales.empty() )
173  {
174  setlocale( LC_NUMERIC, m_ReplacedCLocales.top().c_str() );
175  m_ReplacedCLocales.pop();
176  }
177  else
178  {
179  MITK_WARN << "Mismatched PopLocale on DICOMITKSeriesGDCMReader.";
180  }
181 
182  if ( !m_ReplacedCinLocales.empty() )
183  {
184  std::cin.imbue( m_ReplacedCinLocales.top() );
185  m_ReplacedCinLocales.pop();
186  }
187  else
188  {
189  MITK_WARN << "Mismatched PopLocale on DICOMITKSeriesGDCMReader.";
190  }
191 
192  s_LocaleMutex->Unlock();
193 }
194 
197 {
198  return input; // to be implemented differently by sub-classes
199 }
200 
201 #if defined( MBILOG_ENABLE_DEBUG ) || defined( ENABLE_TIMING )
202 #define timeStart( part ) timer.Start( part );
203 #define timeStop( part ) timer.Stop( part );
204 #else
205 #define timeStart( part )
206 #define timeStop( part )
207 #endif
208 
210 {
211  itk::TimeProbesCollectorBase timer;
212 
213  timeStart( "Reset" );
214  this->ClearOutputs();
215  timeStop( "Reset" );
216 
217  // prepare initial sorting (== list of input files)
218  const StringList inputFilenames = this->GetInputFiles();
219  timeStart( "Check input for DCM" );
220  if ( inputFilenames.empty() || !this->CanHandleFile( inputFilenames.front() ) // first
221  || !this->CanHandleFile( inputFilenames.back() ) // last
222  || !this->CanHandleFile( inputFilenames[inputFilenames.size() / 2] ) // roughly central file
223  )
224  {
225  // TODO a read-as-many-as-possible fallback could be implemented here
226  MITK_DEBUG << "Reader unable to process files..";
227  return;
228  }
229 
230  timeStop( "Check input for DCM" );
231 
232  // scan files for sorting-relevant tags
233  if ( m_TagCache.IsNull() || ( m_TagCache->GetMTime()<this->GetMTime() && !m_ExternalCache ))
234  {
235  timeStart( "Tag scanning" );
236  DICOMGDCMTagScanner::Pointer filescanner = DICOMGDCMTagScanner::New();
237 
238  filescanner->SetInputFiles( inputFilenames );
239  filescanner->AddTagPaths( this->GetTagsOfInterest() );
240 
241  PushLocale();
242  filescanner->Scan();
243  PopLocale();
244 
245  m_TagCache = filescanner->GetScanCache(); // keep alive and make accessible to sub-classes
246 
247  timeStop("Tag scanning");
248  }
249  else
250  {
251  // ensure that the tag cache contains our required tags AND files and has scanned!
252  }
253 
254  m_SortingResultInProgress.clear();
255  m_SortingResultInProgress.push_back(m_TagCache->GetFrameInfoList());
256 
257  // sort and split blocks as configured
258 
259  timeStart( "Sorting frames" );
260  unsigned int sorterIndex = 0;
261  for ( auto sorterIter = m_Sorter.cbegin(); sorterIter != m_Sorter.cend(); ++sorterIndex, ++sorterIter )
262  {
263  std::stringstream ss;
264  ss << "Sorting step " << sorterIndex;
265  timeStart( ss.str().c_str() );
266  m_SortingResultInProgress =
267  this->InternalExecuteSortingStep( sorterIndex, *sorterIter, m_SortingResultInProgress );
268  timeStop( ss.str().c_str() );
269  }
270 
271  if ( !m_SimpleVolumeReading )
272  {
273  // a last extra-sorting step: ensure equidistant slices
274  timeStart( "EquiDistantBlocksSorter" );
275  m_SortingResultInProgress = this->InternalExecuteSortingStep(
276  sorterIndex++, m_EquiDistantBlocksSorter.GetPointer(), m_SortingResultInProgress );
277  timeStop( "EquiDistantBlocksSorter" );
278  }
279 
280  timeStop( "Sorting frames" );
281 
282  timeStart( "Condensing 3D blocks" );
283  m_SortingResultInProgress = this->Condense3DBlocks( m_SortingResultInProgress );
284  timeStop( "Condensing 3D blocks" );
285 
286  // provide final result as output
287 
288  timeStart( "Output" );
289  unsigned int o = this->GetNumberOfOutputs();
290  this->SetNumberOfOutputs(
291  o + m_SortingResultInProgress.size() ); // Condense3DBlocks may already have added outputs!
292  for ( auto blockIter = m_SortingResultInProgress.cbegin(); blockIter != m_SortingResultInProgress.cend();
293  ++o, ++blockIter )
294  {
295  const DICOMDatasetAccessingImageFrameList& gdcmFrameInfoList = *blockIter;
296  assert( !gdcmFrameInfoList.empty() );
297 
298  // reverse frames if necessary
299  // update tilt information from absolute last sorting
300  const DICOMDatasetList datasetList = ConvertToDICOMDatasetList( gdcmFrameInfoList );
301  m_NormalDirectionConsistencySorter->SetInput( datasetList );
303  const DICOMDatasetAccessingImageFrameList sortedGdcmInfoFrameList =
305  const GantryTiltInformation& tiltInfo = m_NormalDirectionConsistencySorter->GetTiltInformation();
306 
307  // set frame list for current block
308  const DICOMImageFrameList frameList = ConvertToDICOMImageFrameList( sortedGdcmInfoFrameList );
309  assert( !frameList.empty() );
310 
312  block.SetTagCache( this->GetTagCache() ); // important: this must be before SetImageFrameList(), because
313  // SetImageFrameList will trigger reading of lots of interesting
314  // tags!
315  block.SetAdditionalTagsOfInterest( GetAdditionalTagsOfInterest() );
316  block.SetTagLookupTableToPropertyFunctor( GetTagLookupTableToPropertyFunctor() );
317  block.SetImageFrameList( frameList );
318  block.SetTiltInformation( tiltInfo );
319 
320  block.SetReaderImplementationLevel( this->GetReaderImplementationLevel( block.GetSOPClassUID() ) );
321 
322  this->SetOutput( o, block );
323  }
324  timeStop( "Output" );
325 
326 #if defined( MBILOG_ENABLE_DEBUG ) || defined( ENABLE_TIMING )
327  std::cout << "---------------------------------------------------------------" << std::endl;
328  timer.Report( std::cout );
329  std::cout << "---------------------------------------------------------------" << std::endl;
330 #endif
331 }
332 
334  unsigned int sortingStepIndex, const DICOMDatasetSorter::Pointer& sorter, const SortingBlockList& input )
335 {
336  SortingBlockList nextStepSorting; // we should not modify our input list while processing it
337  std::stringstream ss;
338  ss << "Sorting step " << sortingStepIndex << " '";
339 #if defined( MBILOG_ENABLE_DEBUG )
340  sorter->PrintConfiguration( ss );
341 #endif
342  ss << "'";
343  nextStepSorting.clear();
344 
345  MITK_DEBUG << "================================================================================";
346  MITK_DEBUG << "DICOMITKSeriesGDCMReader: " << ss.str() << ": " << input.size() << " groups input";
347  unsigned int groupIndex = 0;
348 
349  for ( auto blockIter = input.cbegin(); blockIter != input.cend(); ++groupIndex, ++blockIter )
350  {
351  const DICOMDatasetAccessingImageFrameList& gdcmInfoFrameList = *blockIter;
352  const DICOMDatasetList datasetList = ConvertToDICOMDatasetList( gdcmInfoFrameList );
353 
354 #if defined( MBILOG_ENABLE_DEBUG )
355  MITK_DEBUG << "--------------------------------------------------------------------------------";
356  MITK_DEBUG << "DICOMITKSeriesGDCMReader: " << ss.str() << ", dataset group " << groupIndex << " ("
357  << datasetList.size() << " datasets): ";
358  for ( auto oi = datasetList.cbegin(); oi != datasetList.cend(); ++oi )
359  {
360  MITK_DEBUG << " INPUT : " << ( *oi )->GetFilenameIfAvailable();
361  }
362 #endif
363 
364  sorter->SetInput( datasetList );
365  sorter->Sort();
366  unsigned int numberOfResultingBlocks = sorter->GetNumberOfOutputs();
367 
368  for ( unsigned int b = 0; b < numberOfResultingBlocks; ++b )
369  {
370  const DICOMDatasetList blockResult = sorter->GetOutput( b );
371 
372  for ( auto oi = blockResult.cbegin(); oi != blockResult.cend(); ++oi )
373  {
374  MITK_DEBUG << " OUTPUT(" << b << ") :" << ( *oi )->GetFilenameIfAvailable();
375  }
376 
378  nextStepSorting.push_back( sortedGdcmInfoFrameList );
379  }
380  }
381 
382  return nextStepSorting;
383 }
384 
387 {
388  if ( sopClassUID.empty() )
389  {
390  return SOPClassUnknown;
391  }
392 
393  gdcm::UIDs uidKnowledge;
394  uidKnowledge.SetFromUID( sopClassUID.c_str() );
395 
396  gdcm::UIDs::TSName gdcmType = static_cast<gdcm::UIDs::TSName>((gdcm::UIDs::TSType)uidKnowledge);
397 
398  switch ( gdcmType )
399  {
400  case gdcm::UIDs::CTImageStorage:
401  case gdcm::UIDs::MRImageStorage:
402  case gdcm::UIDs::PositronEmissionTomographyImageStorage:
403  case gdcm::UIDs::ComputedRadiographyImageStorage:
404  case gdcm::UIDs::DigitalXRayImageStorageForPresentation:
405  case gdcm::UIDs::DigitalXRayImageStorageForProcessing:
406  return SOPClassSupported;
407 
408  case gdcm::UIDs::NuclearMedicineImageStorage:
410 
411  case gdcm::UIDs::SecondaryCaptureImageStorage:
412  return SOPClassImplemented;
413 
414  default:
415  return SOPClassUnsupported;
416  }
417 }
418 
419 // void AllocateOutputImages();
420 
422 {
423  bool success = true;
424 
425  unsigned int numberOfOutputs = this->GetNumberOfOutputs();
426  for ( unsigned int o = 0; o < numberOfOutputs; ++o )
427  {
428  success &= this->LoadMitkImageForOutput( o );
429  }
430 
431  return success;
432 }
433 
435  DICOMImageBlockDescriptor& block ) const
436 {
437  PushLocale();
438  const DICOMImageFrameList& frames = block.GetImageFrameList();
439  const GantryTiltInformation tiltInfo = block.GetTiltInformation();
440  bool hasTilt = tiltInfo.IsRegularGantryTilt();
441 
443  filenames.reserve( frames.size() );
444  for ( auto frameIter = frames.cbegin(); frameIter != frames.cend(); ++frameIter )
445  {
446  filenames.push_back( ( *frameIter )->Filename );
447  }
448 
450  bool success( true );
451  try
452  {
453  mitk::Image::Pointer mitkImage = helper.Load( filenames, m_FixTiltByShearing && hasTilt, tiltInfo );
454  block.SetMitkImage( mitkImage );
455  }
456  catch ( const std::exception& e )
457  {
458  success = false;
459  MITK_ERROR << "Exception during image loading: " << e.what();
460  }
461 
462  PopLocale();
463 
464  return success;
465 }
466 
467 
469 {
470  DICOMImageBlockDescriptor& block = this->InternalGetOutput( o );
471  return this->LoadMitkImageForImageBlockDescriptor( block );
472 }
473 
474 
475 bool mitk::DICOMITKSeriesGDCMReader::CanHandleFile( const std::string& filename )
476 {
478 }
479 
481 {
482  assert( sorter );
483 
484  if ( atFront )
485  {
486  m_Sorter.push_front( sorter );
487  }
488  else
489  {
490  m_Sorter.push_back( sorter );
491  }
492  this->Modified();
493 }
494 
497 {
498  std::list<DICOMDatasetSorter::ConstPointer> result;
499 
500  unsigned int sortIndex( 0 );
501  for ( auto sorterIter = m_Sorter.begin(); sorterIter != m_Sorter.end(); ++sortIndex, ++sorterIter )
502  {
503  if ( sortIndex > 0 ) // ignore first element (see EnsureMandatorySortersArePresent)
504  {
505  result.push_back( ( *sorterIter ).GetPointer() );
506  }
507  }
508 
509  return result;
510 }
511 
512 void mitk::DICOMITKSeriesGDCMReader::EnsureMandatorySortersArePresent(
513  unsigned int decimalPlacesForOrientation, bool simpleVolumeImport )
514 {
515  DICOMTagBasedSorter::Pointer splitter = DICOMTagBasedSorter::New();
516  splitter->AddDistinguishingTag( DICOMTag(0x0028, 0x0010) ); // Number of Rows
517  splitter->AddDistinguishingTag( DICOMTag(0x0028, 0x0011) ); // Number of Columns
518  splitter->AddDistinguishingTag( DICOMTag(0x0028, 0x0030) ); // Pixel Spacing
519  splitter->AddDistinguishingTag( DICOMTag(0x0018, 0x1164) ); // Imager Pixel Spacing
520  splitter->AddDistinguishingTag( DICOMTag(0x0020, 0x0037), new mitk::DICOMTagBasedSorter::CutDecimalPlaces(decimalPlacesForOrientation) ); // Image Orientation (Patient)
521  splitter->AddDistinguishingTag( DICOMTag(0x0018, 0x0050) ); // Slice Thickness
522  if ( simpleVolumeImport )
523  {
524  MITK_DEBUG << "Simple volume reading: ignoring number of frames";
525  }
526  else
527  {
528  splitter->AddDistinguishingTag( DICOMTag(0x0028, 0x0008) ); // Number of Frames
529  }
530 
531  this->AddSortingElement( splitter, true ); // true = at front
532 
533  if ( m_EquiDistantBlocksSorter.IsNull() )
534  {
535  m_EquiDistantBlocksSorter = mitk::EquiDistantBlocksSorter::New();
536  }
538 
539  if ( m_NormalDirectionConsistencySorter.IsNull() )
540  {
541  m_NormalDirectionConsistencySorter = mitk::NormalDirectionConsistencySorter::New();
542  }
543 }
544 
545 void mitk::DICOMITKSeriesGDCMReader::SetToleratedOriginOffsetToAdaptive( double fractionOfInterSliceDistance ) const
546 {
547  assert( m_EquiDistantBlocksSorter.IsNotNull() );
548  m_EquiDistantBlocksSorter->SetToleratedOriginOffsetToAdaptive( fractionOfInterSliceDistance );
549  this->Modified();
550 }
551 
553 {
554  assert( m_EquiDistantBlocksSorter.IsNotNull() );
555  m_EquiDistantBlocksSorter->SetToleratedOriginOffset( millimeters );
556  this->Modified();
557 }
558 
560 {
561  assert( m_EquiDistantBlocksSorter.IsNotNull() );
562  return m_EquiDistantBlocksSorter->GetToleratedOriginOffset();
563 }
564 
566 {
567  assert( m_EquiDistantBlocksSorter.IsNotNull() );
568  return m_EquiDistantBlocksSorter->IsToleratedOriginOffsetAbsolute();
569 }
570 
572 {
573  return m_DecimalPlacesForOrientation;
574 }
575 
576 mitk::DICOMTagCache::Pointer mitk::DICOMITKSeriesGDCMReader::GetTagCache() const
577 {
578  return m_TagCache;
579 }
580 
581 void mitk::DICOMITKSeriesGDCMReader::SetTagCache( const DICOMTagCache::Pointer& tagCache )
582 {
583  m_TagCache = tagCache;
584  m_ExternalCache = tagCache.IsNotNull();
585 }
586 
588 {
589  DICOMTagPathList completeList;
590 
591  // check all configured sorters
592  for ( auto sorterIter = m_Sorter.cbegin(); sorterIter != m_Sorter.cend(); ++sorterIter )
593  {
594  assert( sorterIter->IsNotNull() );
595 
596  const DICOMTagList tags = ( *sorterIter )->GetTagsOfInterest();
597  completeList.insert( completeList.end(), tags.cbegin(), tags.cend() );
598  }
599 
600  // check our own forced sorters
601  DICOMTagList tags = m_EquiDistantBlocksSorter->GetTagsOfInterest();
602  completeList.insert( completeList.end(), tags.cbegin(), tags.cend() );
603 
604  tags = m_NormalDirectionConsistencySorter->GetTagsOfInterest();
605  completeList.insert( completeList.end(), tags.cbegin(), tags.cend() );
606 
607  // add the tags for DICOMImageBlockDescriptor
609  completeList.insert( completeList.end(), tags.cbegin(), tags.cend() );
610 
611 
613  for ( auto iter = tagList.cbegin();
614  iter != tagList.cend();
615  ++iter
616  )
617  {
618  completeList.push_back( iter->first ) ;
619  }
620 
621  return completeList;
622 }
void SetToleratedOriginOffsetToAdaptive(double fractionOfInterSliceDistanct=0.3) const
See Forced Configuration.
bool CanHandleFile(const std::string &filename) override
Indicate whether this reader can handle given file.
virtual bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor &block) const
const GantryTiltInformation GetTiltInformation() const
Describe the gantry tilt of the acquisition.
void InternalPrintConfiguration(std::ostream &os) const override
Configuration description for human reader, to be implemented by sub-classes.
mitk::DICOMImageBlockDescriptor::TagLookupTableToPropertyFunctor GetTagLookupTableToPropertyFunctor() const
loader did not yet inspect any images, unknown fitness
bool operator==(const DICOMFileReader &other) const override
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT...
#define MITK_ERROR
Definition: mitkLogMacros.h:20
static bool CanHandleFile(const std::string &filename)
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:59
static std::string GetActiveLocale()
Return active C locale.
void SetTagCache(const DICOMTagCache::Pointer &) override
A way to provide external knowledge about files and tag values is appreciated.
void SetNumberOfOutputs(unsigned int numberOfOutputs)
ConstSorterList GetFreelyConfiguredSortingElements() const
mitk::EquiDistantBlocksSorter::Pointer m_EquiDistantBlocksSorter
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:32
Image::Pointer Load(const StringContainer &filenames, bool correctTilt, const GantryTiltInformation &tiltInfo)
void AnalyzeInputFiles() override
Runs the sorting / splitting process described in Loading strategy. Method required by DICOMFileReade...
void SetFixTiltByShearing(bool on)
Controls whether to "fix" tilted acquisitions by shearing the output (see Gantry tilt handling)...
virtual AdditionalTagsMapType GetAdditionalTagsOfInterest() const
#define MITK_DEBUG
Definition: mitkLogMacros.h:22
MITKDICOMREADER_EXPORT mitk::DICOMDatasetList ConvertToDICOMDatasetList(const DICOMDatasetAccessingImageFrameList &input)
void SetOutput(unsigned int index, const DICOMImageBlockDescriptor &output)
loader code and tests are established
virtual SortingBlockList Condense3DBlocks(SortingBlockList &resultOf3DGrouping)
"Hook" for sub-classes, see Sub-classes can condense multiple blocks into a single larger block ...
MITKDICOMREADER_EXPORT mitk::DICOMDatasetAccessingImageFrameList ConvertToDICOMDatasetAccessingImageFrameList(const DICOMDatasetList &input)
const DICOMImageFrameList & GetImageFrameList() const
List of frames that constitute the mitk::Image (DICOMImageFrames)
const StringList & GetInputFiles() const
This input files.
static Pointer New()
void PushLocale() const
Remember current locale on stack, activate "C" locale. "C" locale is required for correct parsing of ...
bool LoadImages() override
Loads images using itk::ImageSeriesReader, potentially applies shearing to correct gantry tilt...
static SortingBlockList InternalExecuteSortingStep(unsigned int sortingStepIndex, const DICOMDatasetSorter::Pointer &sorter, const SortingBlockList &input)
Sorting step as described in Loading strategy.
loader code is not known to work with this SOP Class
loader code is implemented but not accompanied by tests
void SetMitkImage(Image::Pointer image)
The 3D mitk::Image that is loaded from the DICOM files of a DICOMImageFrameList.
#define timeStart(part)
unsigned int GetNumberOfOutputs() const
Number of outputs, only meaningful after calling AnalyzeInputFiles()
const std::list< DICOMDatasetSorter::ConstPointer > ConstSorterList
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type (see mitk::DICOMFileReader).
#define MITK_WARN
Definition: mitkLogMacros.h:19
void SetToleratedOriginOffset(double millimeters=0.005) const
See Forced Configuration.
void PopLocale() const
Activate last remembered locale from locale stack "C" locale is required for correct parsing of numbe...
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
DICOMImageBlockDescriptor & InternalGetOutput(unsigned int index)
non-const access to the DICOMImageBlockDescriptor
DICOMImageBlockDescriptor::AdditionalTagsMapType AdditionalTagsMapType
Output descriptor for DICOMFileReader.
void SetTagCache(DICOMTagCache *privateCache)
virtual void AddSortingElement(DICOMDatasetSorter *sorter, bool atFront=false)
Add an element to the sorting procedure described in Loading strategy.
virtual bool LoadMitkImageForOutput(unsigned int o)
Loads the mitk::Image by means of an itk::ImageSeriesReader.
std::vector< std::string > StringList
std::vector< DICOMTagPath > DICOMTagPathList
std::vector< DICOMDatasetAccessingImageFrameList > SortingBlockList
MITKDICOMREADER_EXPORT mitk::DICOMImageFrameList ConvertToDICOMImageFrameList(const DICOMDatasetAccessingImageFrameList &input)
static ReaderImplementationLevel GetReaderImplementationLevel(const std::string sopClassUID)
Describe this reader&#39;s confidence for given SOP class UID.
std::vector< DICOMDatasetAccessingImageFrameInfo::Pointer > DICOMDatasetAccessingImageFrameList
Cuts a number after configured number of decimal places. An instance of this class can be used to avo...
Gantry tilt analysis result.
loader code and tests are establised for specific parts of a SOP Class
DICOMITKSeriesGDCMReader & operator=(const DICOMITKSeriesGDCMReader &other)
bool IsRegularGantryTilt() const
Whether the shearing is a gantry tilt or more complicated.
MITKCORE_EXPORT const ScalarType eps
void SetAcceptTwoSlicesGroups(bool accept) const
Controls whether groups of only two images are accepted when ensuring consecutive slices via EquiDist...
DICOMFileReader & operator=(const DICOMFileReader &other)
static mitk::PlanarFigure::Pointer Clone(mitk::PlanarFigure::Pointer original)
std::vector< DICOMDatasetAccess * > DICOMDatasetList
Interface for DICOM readers that produce mitk::Images.
#define timeStop(part)
mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter
virtual DICOMTagCache::Pointer GetTagCache() const
DICOMITKSeriesGDCMReader(unsigned int decimalPlacesForOrientation=m_DefaultDecimalPlacesForOrientation, bool simpleVolumeImport=m_DefaultSimpleVolumeImport)
DICOMTagPathList GetTagsOfInterest() const override