go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkListSampleCArray.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkListSampleCArray_h
19 #define __itkListSampleCArray_h
20 
21 #include "itkObjectFactory.h"
22 //#include "itkListSampleBase.h"
23 #include "itkSample.h"
24 
25 namespace itk
26 {
27 namespace Statistics
28 {
29 
44 template< class TMeasurementVector, class TInternalValue = typename TMeasurementVector::ValueType >
46  public Sample< TMeasurementVector >
47 {
48 public:
49 
52  typedef Sample< TMeasurementVector > Superclass;
54  typedef SmartPointer< const Self > ConstPointer;
55 
57  itkNewMacro( Self );
58 
60  itkTypeMacro( ListSampleCArray, Sample );
61 
63  typedef typename Superclass::MeasurementVectorType MeasurementVectorType;
64  typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType;
65  typedef typename Superclass::MeasurementType MeasurementType;
66  typedef typename Superclass::AbsoluteFrequencyType AbsoluteFrequencyType;
67  typedef typename Superclass::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType;
68  typedef typename Superclass::InstanceIdentifier InstanceIdentifier;
69 
71  typedef TInternalValue InternalValueType;
72  typedef InternalValueType * InternalDataType;
73  typedef InternalDataType * InternalDataContainerType;
74 
76  itkGetConstMacro( InternalContainer, InternalDataContainerType );
77 
79  void Resize( unsigned long n );
80 
82  void SetActualSize( unsigned long n );
83 
85  unsigned long GetActualSize( void );
86 
88  void Clear( void );
89 
91  virtual InstanceIdentifier Size( void ) const
92  {
93  return this->m_InternalContainerSize;
94  }
95 
96 
103  virtual const MeasurementVectorType & GetMeasurementVector(
104  InstanceIdentifier id ) const;
105 
107  void GetMeasurementVector( InstanceIdentifier id,
108  MeasurementVectorType & mv ) const;
109 
111  void SetMeasurement( InstanceIdentifier id,
112  unsigned int dim, const MeasurementType & value );
113 
115  void SetMeasurementVector( InstanceIdentifier id,
116  const MeasurementVectorType & mv );
117 
119  virtual AbsoluteFrequencyType GetFrequency( InstanceIdentifier id ) const;
120 
122  virtual TotalAbsoluteFrequencyType GetTotalFrequency( void ) const
123  {
124  return static_cast< TotalAbsoluteFrequencyType >( this->m_InternalContainerSize );
125  }
126 
127 
128 protected:
129 
131  virtual ~ListSampleCArray();
132  void PrintSelf( std::ostream & os, Indent indent ) const;
133 
134 private:
135 
136  ListSampleCArray( const Self & ); // purposely not implemented
137  void operator=( const Self & ); // purposely not implemented
138 
140  InternalDataContainerType m_InternalContainer;
141  InstanceIdentifier m_InternalContainerSize;
142  InstanceIdentifier m_ActualSize;
143 
145  mutable MeasurementVectorType m_TemporaryMeasurementVector;
146 
148  void AllocateInternalContainer( unsigned long size, unsigned int dim );
149 
151  void DeallocateInternalContainer( void );
152 
153 };
154 
155 } // end namespace Statistics
156 } // end namespace itk
157 
158 #ifndef ITK_MANUAL_INSTANTIATION
159 #include "itkListSampleCArray.hxx"
160 #endif
161 
162 #endif // end #ifndef __itkListSampleCArray_h
void Resize(unsigned long n)
MeasurementVectorType m_TemporaryMeasurementVector
SmartPointer< const Self > ConstPointer
Sample< TMeasurementVector > Superclass
Superclass::MeasurementVectorSizeType MeasurementVectorSizeType
unsigned long GetActualSize(void)
Superclass::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
void SetMeasurement(InstanceIdentifier id, unsigned int dim, const MeasurementType &value)
void SetMeasurementVector(InstanceIdentifier id, const MeasurementVectorType &mv)
void SetActualSize(unsigned long n)
InternalDataType * InternalDataContainerType
virtual InstanceIdentifier Size(void) const
Superclass::MeasurementVectorType MeasurementVectorType
InternalDataContainerType m_InternalContainer
A ListSampleBase that internally uses a CArray, which can be accessed.
virtual TotalAbsoluteFrequencyType GetTotalFrequency(void) const
virtual AbsoluteFrequencyType GetFrequency(InstanceIdentifier id) const
Superclass::InstanceIdentifier InstanceIdentifier
void AllocateInternalContainer(unsigned long size, unsigned int dim)
virtual const MeasurementVectorType & GetMeasurementVector(InstanceIdentifier id) const
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::AbsoluteFrequencyType AbsoluteFrequencyType
Superclass::MeasurementType MeasurementType


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo