ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkAnalyzeObjectEntry.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: itkIOCommon.cxx,v $
5 Language: C++
6 Date: $Date: 2007/08/22 14:18:08 $
7 Version: $Revision: 1.0 $
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 
18 #ifndef itkAnalyzeObjectEntry_h
19 #define itkAnalyzeObjectEntry_h
20 
21 #include <string>
22 #include <stdio.h>
23 #include <iostream>
24 #include <fstream>
25 
26 #include "itkObjectFactory.h"
27 #include "itkImage.h"
28 #include "itkByteSwapper.h"
29 #include "itksys/SystemTools.hxx"
30 #include "itkImageIOBase.h"
31 
32 namespace itk
33 {
34 
40 class AnalyzeObjectEntry : public Object
41 {
42 public:
43 
46  typedef Object Superclass;
51 
53  itkNewMacro(Self);
54 
56  itkTypeMacro(AnalyzeObjectEntry, Object);
57 
65 
73  virtual std::string GetName( void ) const
74  {
75  itkDebugMacro("returning " << "Name of " << this->m_Name );
76  return std::string(this->m_Name);
77  }
79 
81  virtual void SetName(const std::string _arg)
82  {
83  char temp[32];
85 
86  strncpy(temp, _arg.c_str(), 31);
87  temp[31] = '\0';
88  itkDebugMacro("setting " << "Name" << " to " << temp);
89  if( strcmp(this->m_Name, temp) != 0 )
90  {
91  strncpy(this->m_Name, temp, 32);
92  this->Modified();
93  }
94  }
95 
104  itkGetConstMacro(DisplayFlag, int);
105  itkSetMacro(DisplayFlag, int);
107 
115  itkGetConstMacro(CopyFlag, unsigned char);
116  itkSetMacro(CopyFlag, unsigned char);
118 
125  itkGetConstMacro(MirrorFlag, unsigned char);
126  itkSetMacro(MirrorFlag, unsigned char);
128 
135  itkGetConstMacro(StatusFlag, unsigned char);
136  itkSetMacro(StatusFlag, unsigned char);
138 
145  itkGetConstMacro(NeighborsUsedFlag, unsigned char);
146  itkSetMacro(NeighborsUsedFlag, unsigned char);
148 
155  itkGetConstMacro(Shades, int);
156  itkSetMacro(Shades, int);
158 
166  itkGetConstMacro(StartRed, int);
167  itkSetMacro(StartRed, int);
169 
177  itkGetConstMacro(StartGreen, int);
178  itkSetMacro(StartGreen, int);
180 
188  itkGetConstMacro(StartBlue, int);
189  itkSetMacro(StartBlue, int);
191 
197  itkGetConstMacro(EndRed, int);
198  itkSetMacro(EndRed, int);
200 
206  itkGetConstMacro(EndGreen, int);
207  itkSetMacro(EndGreen, int);
209 
215  itkGetConstMacro(EndBlue, int);
216  itkSetMacro(EndBlue, int);
218 
225  itkGetConstMacro(XRotation, int);
226  itkSetMacro(XRotation, int);
228 
235  itkGetConstMacro(XRotationIncrement, int);
236  itkSetMacro(XRotationIncrement, int);
238 
245  itkGetConstMacro(YRotation, int);
246  itkSetMacro(YRotation, int);
248 
255  itkGetConstMacro(YRotationIncrement, int);
256  itkSetMacro(YRotationIncrement, int);
258 
265  itkGetConstMacro(ZRotation, int);
266  itkSetMacro(ZRotation, int);
268 
275  itkGetConstMacro(ZRotationIncrement, int);
276  itkSetMacro(ZRotationIncrement, int);
278 
285  itkGetConstMacro(XTranslation, int);
286  itkSetMacro(XTranslation, int);
288 
296  itkGetConstMacro(XTranslationIncrement, int);
297  itkSetMacro(XTranslationIncrement, int);
299 
306  itkGetConstMacro(YTranslation, int);
307  itkSetMacro(YTranslation, int);
309 
317  itkGetConstMacro(YTranslationIncrement, int);
318  itkSetMacro(YTranslationIncrement, int);
320 
327  itkGetConstMacro(ZTranslation, int);
328  itkSetMacro(ZTranslation, int);
330 
338  itkGetConstMacro(ZTranslationIncrement, int);
339  itkSetMacro(ZTranslationIncrement, int);
341 
349  itkGetConstMacro(XCenter, int);
350  itkSetMacro(XCenter, int);
352 
360  itkGetConstMacro(YCenter, int);
361  itkSetMacro(YCenter, int);
363 
371  itkGetConstMacro(ZCenter, int);
372  itkSetMacro(ZCenter, int);
374 
382  itkGetConstMacro(MinimumXValue, short int);
383  itkSetMacro(MinimumXValue, int);
385 
393  itkGetConstMacro(MinimumYValue, short int);
394  itkSetMacro(MinimumYValue, int);
396 
404  itkGetConstMacro(MinimumZValue, short int);
405  itkSetMacro(MinimumZValue, int);
407 
415  itkGetConstMacro(MaximumXValue, short int);
416  itkSetMacro(MaximumXValue, int);
418 
426  itkGetConstMacro(MaximumYValue, short int);
427  itkSetMacro(MaximumYValue, int);
429 
437  itkGetConstMacro(MaximumZValue, short int);
438  itkSetMacro(MaximumZValue, int);
440 
458  itkGetConstMacro(Opacity, float);
459  itkSetMacro(Opacity, float);
461 
467  itkGetConstMacro(OpacityThickness, int);
468  itkSetMacro(OpacityThickness, int);
470 
480  itkGetConstMacro(BlendFactor, float);
481  itkSetMacro(BlendFactor, float);
483 
484  // TODO: Need to use these at some point or maybe just delete them
485 #if 0
486 
491  itkSetMacro( StartColor, intRGBPixel);
492  itkGetConstMacro(StartColor, intRGBPixel);
494 
500  itkSetMacro(EndColor, intRGBPixel);
501  itkGetConstMacro(EndColor, intRGBPixel);
503 
509  itkSetMacro(Rotation, Index);
510  itkGetConstMacro(Rotation, Index);
512 
518  itkSetMacro(Translation, Index);
519  itkGetConstMacro(Translation, Index);
521 
527  itkSetMacro(Center, Index);
528  itkGetConstMacro(Center, Index);
530 
536  itkSetMacro(RotationIncrement, Index);
537  itkGetConstMacro(RotationIncrement, Index);
539 
545  itkSetMacro(TranslationIncrement, Index);
546  itkGetConstMacro(TranslationIncrement, Index);
548 
554  itkSetMacro(MinimumCoordinateValue, Index);
555  itkGetConstMacro(MinimumCoordinateValue, Index);
557 
563  itkSetMacro(MaximumCoordinateValue, Index);
564  itkGetConstMacro(MaximumCoordinateValue, Index);
565 #endif
566 
567 
574  void Print(std::ostream & myfile);
575 
581  void ReadFromFilePointer(std::ifstream & inputFileStream, const bool NeedByteSwap, const bool /* NeedBlendFactor */);
582 
589  void SwapObjectEndedness();
590 
596  void Write(std::ofstream & outputFileStream);
597 protected:
598 
604  AnalyzeObjectEntry( void );
605 
613  virtual ~AnalyzeObjectEntry( void );
614 
615  void PrintSelf(std::ostream& os, Indent indent) const;
616 
617 private:
618  template <typename TValue>
619  void ReadBytes(std::ifstream & inputFileStream,
620  TValue * dest,
621  const int Replications,
622  const bool NeedByteSwap);
623 
624  char m_Name[33]; /*bytes 0-31*/
625  int m_DisplayFlag; /*bytes 32-35*/
626  unsigned char m_CopyFlag; /*bytes 36-36*/
627  unsigned char m_MirrorFlag; /*bytes 37-37*/
628  unsigned char m_StatusFlag; /*bytes 38-38*/
629  unsigned char m_NeighborsUsedFlag; /*bytes 39-39*/
630  int m_Shades; /*bytes 40-43*/
631  int m_StartRed; /*bytes 44-47*/
632  int m_StartGreen; /*bytes 48-51*/
633  int m_StartBlue; /*bytes 52-55*/
634  int m_EndRed; /*bytes 53-58*/
635  int m_EndGreen; /*bytes 59-62*/
636  int m_EndBlue; /*bytes 63-66*/
637  int m_XRotation; /*bytes 67-70*/
638  int m_YRotation; /*bytes 71-74*/
639  int m_ZRotation; /*bytes 75-78*/
640  int m_XTranslation; /*bytes 79-82*/
641  int m_YTranslation; /*bytes 83-86*/
642  int m_ZTranslation; /*bytes 87-90*/
643  int m_XCenter; /*bytes 91-94*/
644  int m_YCenter; /*bytes 95-98*/
645  int m_ZCenter; /*bytes 99-102*/
646  int m_XRotationIncrement; /*bytes 103-106*/
647  int m_YRotationIncrement; /*bytes 107-110*/
648  int m_ZRotationIncrement; /*bytes 111-114*/
649  int m_XTranslationIncrement; /*bytes 115-118*/
650  int m_YTranslationIncrement; /*bytes 119-121*/
651  int m_ZTranslationIncrement; /*bytes 122-125*/
652  short int m_MinimumXValue; /*bytes 126-127*/
653  short int m_MinimumYValue; /*bytes 128-129*/
654  short int m_MinimumZValue; /*bytes 130-131*/
655  short int m_MaximumXValue; /*bytes 132-133*/
656  short int m_MaximumYValue; /*bytes 134-135*/
657  short int m_MaximumZValue; /*bytes 136-137*/
658  float m_Opacity; /*bytes 138-141*/
659  int m_OpacityThickness; /*bytes 142-145*/
660  float m_BlendFactor; /*bytes 146-149*/
661 
662  // TODO: Need to use these at some point or maybe just delete them
663 #if 0
664  // Three seperate Start Colors (Red, Green, Blue) have been put together to use the set macro.
665  intRGBPixel m_StartColor;
666  // Three seperate End Colors (Red, Green, Blue) have been put together to use the set macro.
667  intRGBPixel m_EndColor;
668  // Three seperate Rotations (x, y, z) have been put together to use the set macro.
669  Index m_Rotation;
670  // Three seperate Translations (x, y, z) have been put together to use the set macro.
671  Index m_Translation;
672  // Three seperate Centers (x, y, z) have been put together to use the set macro.
673  Index m_Center;
674  // Three seperate Rotation Increments (x, y, z) have been put together to use the set macro.
675  Index m_RotationIncrement;
676  // Three seperate Translation Increments (x, y, z) have been put together to use the set macro.
677  Index m_TranslationIncrement;
678  // Three seperate Minimum Coordinate Values (x, y, z) have been put together to use the set macro.
679  Index m_MinimumCoordinateValue;
680  // Three seperate Maximum Coordiante Values (x, y, z) have been put together to use the set macro.
681  Index m_MaximumCoordinateValue;
682 #endif
683 };
684 }
685 #endif // __OBJECTENTR_H__
SmartPointer< Self > Pointer
void Copy(AnalyzeObjectEntry::Pointer rhs)
Copy.
Light weight base class for most itk classes.
void Print(std::ostream &myfile)
Print.
virtual void SetName(const std::string _arg)
virtual std::string GetName(void) const
getName/setName
SmartPointer< const Self > ConstPointer
itk::RGBPixel< int > intRGBPixel
virtual ~AnalyzeObjectEntry(void)
~AnalyzeObjectEntry( void ) is the destructor, which does nothing explicitly due to no use of dynamic...
virtual void Modified() const
Represent Red, Green and Blue components for color images.
Definition: itkRGBPixel.h:58
This class encapsulates a single object in an Analyze object file.
AnalyzeObjectEntry(void)
AnalyzeObjectEntry( ) is the default constructor, initializes to 0 or NULL Possible Causes of Failure...
void SwapObjectEndedness()
SwapObjectEndeness.
void Write(std::ofstream &outputFileStream)
Write.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void ReadFromFilePointer(std::ifstream &inputFileStream, const bool NeedByteSwap, const bool)
ReadFromFilePointer.
void PrintSelf(std::ostream &os, Indent indent) const
Base class for most ITK classes.
Definition: itkObject.h:57
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:71
void ReadBytes(std::ifstream &inputFileStream, TValue *dest, const int Replications, const bool NeedByteSwap)