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.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 
00015 #ifndef __itkListSampleCArray_h
00016 #define __itkListSampleCArray_h
00017 
00018 #include "itkObjectFactory.h"
00019 //#include "itkListSampleBase.h"
00020 #include "itkSample.h"
00021 
00022 namespace itk{
00023 namespace Statistics
00024 {
00025 
00040   template < class TMeasurementVector, class TInternalValue = typename TMeasurementVector::ValueType >
00041   class ListSampleCArray
00042     : public Sample< TMeasurementVector >
00043   {
00044   public:
00045 
00047     typedef ListSampleCArray              Self;
00048     typedef Sample< TMeasurementVector >  Superclass;
00049     typedef SmartPointer< Self >          Pointer;
00050     typedef SmartPointer< const Self >    ConstPointer;
00051 
00053     itkNewMacro( Self );
00054 
00056     itkTypeMacro( ListSampleCArray, Sample );
00057 
00059     typedef typename Superclass::MeasurementVectorType      MeasurementVectorType;
00060     typedef typename Superclass::MeasurementVectorSizeType  MeasurementVectorSizeType;
00061     typedef typename Superclass::MeasurementType            MeasurementType;
00062     typedef typename Superclass::AbsoluteFrequencyType      AbsoluteFrequencyType;
00063     typedef typename Superclass::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType;
00064     typedef typename Superclass::InstanceIdentifier         InstanceIdentifier;
00065 
00067     typedef TInternalValue          InternalValueType;
00068     typedef InternalValueType *     InternalDataType;
00069     typedef InternalDataType *      InternalDataContainerType;
00070 
00072     itkGetConstMacro( InternalContainer, InternalDataContainerType );
00073 
00075     void Resize( unsigned long n );
00076 
00078     void SetActualSize( unsigned long n );
00079 
00081     unsigned long GetActualSize( void );
00082 
00084     void Clear( void );
00085 
00087     virtual InstanceIdentifier Size( void ) const
00088     {
00089       return this->m_InternalContainerSize;
00090     }
00091 
00098    virtual const MeasurementVectorType & GetMeasurementVector(
00099       InstanceIdentifier id ) const;
00100 
00102     void GetMeasurementVector( InstanceIdentifier id,
00103       MeasurementVectorType & mv ) const;
00104 
00106     void SetMeasurement( InstanceIdentifier id,
00107       unsigned int dim, const MeasurementType &value );
00108 
00110     void SetMeasurementVector( InstanceIdentifier id,
00111       const MeasurementVectorType &mv );
00112 
00114     virtual AbsoluteFrequencyType GetFrequency( InstanceIdentifier id ) const;
00115 
00117     virtual TotalAbsoluteFrequencyType GetTotalFrequency( void ) const
00118     {
00119       return static_cast<TotalAbsoluteFrequencyType>( this->m_InternalContainerSize );
00120     }
00121 
00122   protected:
00123 
00124     ListSampleCArray();
00125     virtual ~ListSampleCArray();
00126     void PrintSelf( std::ostream& os, Indent indent ) const;
00127 
00128   private:
00129 
00130     ListSampleCArray( const Self& );  // purposely not implemented
00131     void operator=( const Self& );    // purposely not implemented
00132 
00134     InternalDataContainerType   m_InternalContainer;
00135     InstanceIdentifier          m_InternalContainerSize;
00136     InstanceIdentifier          m_ActualSize;
00137 
00139     mutable MeasurementVectorType m_TemporaryMeasurementVector;
00140 
00142     void AllocateInternalContainer( unsigned long size, unsigned int dim );
00143 
00145     void DeallocateInternalContainer( void );
00146 
00147   }; // end class ListSampleCArray
00148 
00149 
00150 } // end namespace Statistics
00151 } // end namespace itk
00152 
00153 
00154 #ifndef ITK_MANUAL_INSTANTIATION
00155 #include "itkListSampleCArray.txx"
00156 #endif
00157 
00158 
00159 #endif // end #ifndef __itkListSampleCArray_h


Generated on 24-10-2011 for elastix by doxygen 1.7.4 elastix logo