Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDICOMITKSeriesGDCMReader.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkDICOMITKSeriesGDCMReader_h
18 #define mitkDICOMITKSeriesGDCMReader_h
19 
20 #include <stack>
21 #include "itkMutexLock.h"
22 #include "mitkDICOMFileReader.h"
23 #include "mitkDICOMDatasetSorter.h"
27 #include "MitkDICOMReaderExports.h"
28 
29 
30 namespace itk
31 {
32  class TimeProbesCollectorBase;
33 }
34 
35 namespace mitk
36 {
37 
195 {
196  public:
197 
200  itkFactorylessNewMacro( DICOMITKSeriesGDCMReader );
202 
207  virtual void AnalyzeInputFiles() override;
208 
209  // void AllocateOutputImages();
213  virtual bool LoadImages() override;
214 
215  // re-implemented from super-class
216  virtual bool CanHandleFile(const std::string& filename) override;
217 
221  virtual void AddSortingElement(DICOMDatasetSorter* sorter, bool atFront = false);
222 
223  typedef const std::list<DICOMDatasetSorter::ConstPointer> ConstSorterList;
224  ConstSorterList GetFreelyConfiguredSortingElements() const;
225 
229  void SetFixTiltByShearing(bool on);
230 
231  bool GetFixTiltByShearing() const;
232 
236  void SetAcceptTwoSlicesGroups(bool accept) const;
237  bool GetAcceptTwoSlicesGroups() const;
238 
242  void SetToleratedOriginOffsetToAdaptive(double fractionOfInterSliceDistanct = 0.3) const;
243 
247  void SetToleratedOriginOffset(double millimeters = 0.005) const;
248 
249  double GetToleratedOriginError() const;
250  bool IsToleratedOriginOffsetAbsolute() const;
251 
252  double GetDecimalPlacesForOrientation() const;
253 
254  virtual bool operator==(const DICOMFileReader& other) const override;
255 
256  virtual DICOMTagPathList GetTagsOfInterest() const override;
257 
258  protected:
259 
260  virtual void InternalPrintConfiguration(std::ostream& os) const override;
261 
263  static std::string GetActiveLocale();
268  void PushLocale() const;
273  void PopLocale() const;
274 
275  DICOMITKSeriesGDCMReader(unsigned int decimalPlacesForOrientation = 5);
276  virtual ~DICOMITKSeriesGDCMReader();
277 
279  DICOMITKSeriesGDCMReader& operator=(const DICOMITKSeriesGDCMReader& other);
280 
281  typedef std::vector<DICOMDatasetAccessingImageFrameList> SortingBlockList;
286  virtual SortingBlockList Condense3DBlocks(SortingBlockList& resultOf3DGrouping);
287 
288  virtual DICOMTagCache::Pointer GetTagCache() const;
289  void SetTagCache( const DICOMTagCache::Pointer& ) override;
290 
292  static SortingBlockList InternalExecuteSortingStep(
293  unsigned int sortingStepIndex,
294  const DICOMDatasetSorter::Pointer& sorter,
295  const SortingBlockList& input);
296 
298  virtual bool LoadMitkImageForOutput(unsigned int o);
299 
300  virtual bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor& block) const;
301 
303  static ReaderImplementationLevel GetReaderImplementationLevel(const std::string sopClassUID);
304  private:
305 
307  void EnsureMandatorySortersArePresent(unsigned int decimalPlacesForOrientation);
308 
309  protected:
310 
311  // NOT nice, made available to ThreeDnTDICOMSeriesReader due to lack of time
312  bool m_FixTiltByShearing; // could be removed by ITKDICOMSeriesReader NOT flagging tilt unless requested to fix it!
313 
314  private:
315 
316  SortingBlockList m_SortingResultInProgress;
317 
318  typedef std::list<DICOMDatasetSorter::Pointer> SorterList;
319  SorterList m_Sorter;
320 
321  protected:
322 
323  // NOT nice, made available to ThreeDnTDICOMSeriesReader and ClassicDICOMSeriesReader due to lack of time
325 
327 
328  private:
329 
330  static itk::MutexLock::Pointer s_LocaleMutex;
331 
332  mutable std::stack<std::string> m_ReplacedCLocales;
333  mutable std::stack<std::locale> m_ReplacedCinLocales;
334 
335  double m_DecimalPlacesForOrientation;
336 
337  DICOMTagCache::Pointer m_TagCache;
338  bool m_ExternalCache;
339 };
340 
341 }
342 
343 #endif
itk::SmartPointer< Self > Pointer
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:76
The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT...
mitk::EquiDistantBlocksSorter::Pointer m_EquiDistantBlocksSorter
#define MITKDICOMREADER_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
const std::list< DICOMDatasetSorter::ConstPointer > ConstSorterList
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type (see mitk::DICOMFileReader).
static const std::string filename
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Output descriptor for DICOMFileReader.
std::vector< DICOMTagPath > DICOMTagPathList
std::vector< DICOMDatasetAccessingImageFrameList > SortingBlockList
#define mitkCloneMacro(classname)
Definition: mitkCommon.h:162
Interface for DICOM readers that produce mitk::Images.
mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter