Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00037 #ifndef __cmtkVolumeFromSlices_h_included_
00038 #define __cmtkVolumeFromSlices_h_included_
00039
00040 #include <cmtkconfig.h>
00041
00042 #include <Base/cmtkTypes.h>
00043 #include <Base/cmtkVolume.h>
00044 #include <Base/cmtkUniformVolume.h>
00045 #include <Base/cmtkScalarImage.h>
00046
00047 #include <stdio.h>
00048
00052
00053 #define CMTK_MAX_CALIB_ERROR 1e-5
00054
00060 #define CMTK_MAX_ANGLE_ERROR 1e-3
00061
00066 #define CMTK_MAX_LOCALIZE_ERROR 1e-2
00067
00068
00069 namespace
00070 cmtk
00071 {
00072
00075
00077 class VolumeFromSlices
00078 {
00079 public:
00081 VolumeFromSlices() : VolumeDataArray( NULL ) {}
00082
00084 virtual ~VolumeFromSlices() {}
00085
00086 protected:
00089 void InitSequence( const ScalarImage* image, const unsigned int numberOfSlices );
00090
00093 virtual char* AllocDataArray( const int bytesperpixel, const int data_size ) const;
00094
00099 virtual TypedArray::SmartPtr EncapDataArray( const ScalarDataType dtype, void *const data, const int data_size ) const;
00100
00106 const char* FillPlane ( unsigned int& plane, const ScalarImage* image );
00107
00118 UniformVolume::SmartPtr FinishVolume( Types::Coordinate& sliceOffset, int& sliceDirection );
00119
00124 UniformVolume::SmartPtr FinishVolume ()
00125 {
00126 Types::Coordinate dummy_c;
00127 int dummy_i;
00128
00129 return FinishVolume( dummy_c, dummy_i );
00130 }
00131
00154 virtual UniformVolume::SmartPtr ConstructVolume( const DataGrid::IndexType& Dims, const UniformVolume::CoordinateVectorType& Size, const Types::Coordinate *Points[3], TypedArray::SmartPtr& Data ) const;
00155
00166 const char* CheckImage ( const int plane, const ScalarImage* image, const unsigned int frame = 0 );
00167
00176 virtual void HandleError ( const char* message ) const
00177 {
00178 fputs ( message, stderr );
00179 }
00180
00181 private:
00185 DataGrid::IndexType Dims;
00186
00191 UniformVolume::CoordinateVectorType Size;
00192
00197 Types::Coordinate* Points[3];
00198
00200 unsigned int DataSize;
00201
00203 char *RawData;
00204
00206 TypedArray::SmartPtr VolumeDataArray;
00207
00209 int BytesPerPixel;
00210
00212 bool SignBit;
00213
00215 ScalarDataType DataType;
00216
00218 Types::Coordinate Spacing[2];
00219
00221 ScalarImage::SpaceVectorType FirstImagePosition;
00222
00224 ScalarImage::SpaceVectorType ImagePosition;
00225
00227 ScalarImage::SpaceVectorType ImageOrientation[2];
00228
00230 int IncX;
00231
00233 int IncY;
00234
00236 int BlockSize;
00237
00244 ScalarImage::SpaceVectorType IncrementVector;
00245
00250 bool Padding;
00251
00254 union {
00255 unsigned char int8;
00256 unsigned short int16;
00257 unsigned int int32;
00258 } PaddingValue;
00259 };
00260
00262
00263 }
00264
00265 #endif // #ifndef __cmtkVolumeFromSlices_h_included_