ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkAnalyzeObjectMap.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: itkNiftiImageIO.cxx,v $
5 Language: C++
6 Date: $Date: 2007/07/27 18:00:56 $
7 Version: $Revision: 1.37 $
8 
9 Copyright (c) Insight Software Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef itkAnalyzeObjectMap_h
18 #define itkAnalyzeObjectMap_h
19 
20 #include <cstdio>
21 #include <string>
22 #include <vector>
23 #include "itkAnalyzeObjectEntry.h"
24 #include "itkObject.h"
25 #include <itkMetaDataDictionary.h>
26 #include "itkMetaDataObject.h"
28 
29 const char *const ANALYZE_OBJECT_LABEL_MAP_ENTRY_ARRAY = "ANALYZE_OBJECT_LABEL_MAP_ENTRY_ARRAY";
33 constexpr int VERSION1 = 880102;
34 constexpr int VERSION2 = 880801;
35 constexpr int VERSION3 = 890102;
36 static const int VERSION4 = 900302;
37 static const int VERSION5 = 910402;
38 static const int VERSION6 = 910926;
39 static const int VERSION7 = 20050829;
40 
41 namespace itk
42 {
43 
44 using AnalyzeObjectEntryArrayType = std::vector<AnalyzeObjectEntry::Pointer>;
45 template <class TImage = itk::Image<unsigned char, 4>, class TRGBImage = itk::Image<itk::RGBPixel<unsigned char>, 4> >
46 
52 class AnalyzeObjectMap : public TImage
53 {
54 public:
55 
57  using Self = AnalyzeObjectMap;
58  using Superclass = TImage;
59  using Pointer = SmartPointer<Self>;
60  using ConstPointer = SmartPointer<const Self>;
61 
62  using ImageType = TImage;
63  using ObjectMapType = itk::AnalyzeObjectMap<TImage>;
64 
65  using PixelType = typename TImage::PixelType;
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(AnalyzeObjectMap, TImage );
72 
78  AnalyzeObjectMap & operator=( const AnalyzeObjectMap & rhs );
79 
85  AnalyzeObjectEntryArrayType * GetAnalyzeObjectEntryArrayPointer();
86 
92  itkSetMacro(NumberOfObjects, int);
93  itkGetConstMacro(NumberOfObjects, int);
95 
107  typename itk::AnalyzeObjectMap<TImage>::Pointer PickOneEntry(const int numberOfEntry = -1);
108 
118  typename TRGBImage::Pointer ObjectMapToRGBImage();
119 
127  void AddObjectEntryBasedOnImagePixel(ImageType *Image, const int value = -1, const std::string ObjectName = "",
128  const int Red = 0, const int Green = 0, const int Blue = 0);
129 
135  void AddAnalyzeObjectEntry(const std::string ObjectName = "");
136 
145  void DeleteAnalyzeObjectEntry(const std::string ObjectName = "");
146 
154  int FindObjectEntry(const std::string ObjectName = "");
155 
162  void PlaceObjectMapEntriesIntoMetaData();
163 
169  AnalyzeObjectEntry::Pointer GetObjectEntry( const int index );
170 
176  const AnalyzeObjectEntry::Pointer GetObjectEntry( const int index ) const;
177 
185  void ImageToObjectMap(ImageType *image);
186 
187 protected:
191  AnalyzeObjectMap( void );
192 
196  ~AnalyzeObjectMap( void ) override;
197 
202  AnalyzeObjectMap( const AnalyzeObjectMap & /* rhs */ ); /*Explicitly not allowed*/
203 
204  void PrintSelf(std::ostream& os, Indent indent) const override;
205 
206 private:
208  int m_NumberOfObjects;
209 
SmartPointer< Self > Pointer
constexpr int VERSION1
static const int VERSION4
const char *const ANALYZE_OBJECT_LABEL_MAP_ENTRY_ARRAY
constexpr int VERSION3
static const int VERSION5
static const int VERSION7
static const int VERSION6
std::vector< AnalyzeObjectEntry::Pointer > AnalyzeObjectEntryArrayType
constexpr int VERSION2