ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkMeshIOBase_h 00019 #define __itkMeshIOBase_h 00020 00021 #include "itkByteSwapper.h" 00022 #include "itkCellInterface.h" 00023 #include "itkCovariantVector.h" 00024 #include "itkDiffusionTensor3D.h" 00025 #include "itkIntTypes.h" 00026 #include "itkLightProcessObject.h" 00027 #include "itkMatrix.h" 00028 #include "itkRGBPixel.h" 00029 #include "itkRGBAPixel.h" 00030 #include "itkSymmetricSecondRankTensor.h" 00031 #include "itkVariableLengthVector.h" 00032 #include "itkVariableSizeMatrix.h" 00033 #include "itkVector.h" 00034 00035 #include <string> 00036 #include <complex> 00037 #include <fstream> 00038 00039 namespace itk 00040 { 00067 class ITK_EXPORT MeshIOBase:public LightProcessObject 00068 { 00069 public: 00071 typedef MeshIOBase Self; 00072 typedef LightProcessObject Superclass; 00073 typedef SmartPointer< const Self > ConstPointer; 00074 typedef SmartPointer< Self > Pointer; 00075 00077 typedef std::vector< std::string > ArrayOfExtensionsType; 00078 00080 typedef std::streamoff StreamOffsetType; 00081 00082 typedef IdentifierType SizeValueType; 00083 00089 class UnknownType {}; 00090 00092 itkTypeMacro(MeshIOBase, LightProcessObject); 00093 00095 itkSetStringMacro(FileName); 00096 itkGetStringMacro(FileName); 00098 00102 typedef enum {UNKNOWNPIXELTYPE, SCALAR, RGB, RGBA, OFFSET, VECTOR, 00103 POINT, COVARIANTVECTOR, SYMMETRICSECONDRANKTENSOR, 00104 DIFFUSIONTENSOR3D, COMPLEX, FIXEDARRAY, ARRAY, MATRIX, 00105 VARIABLELENGTHVECTOR, VARIABLESIZEMATRIX} IOPixelType; 00106 00110 typedef enum {UNKNOWNCOMPONENTTYPE, UCHAR, CHAR, USHORT, SHORT, UINT, INT, 00111 ULONG, LONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LDOUBLE} IOComponentType; 00112 00115 typedef enum {ASCII, BINARY, TYPENOTAPPLICABLE} FileType; 00116 00119 typedef enum {BigEndian, LittleEndian, OrderNotApplicable} ByteOrder; 00120 00122 typedef enum {VERTEX_CELL = 0, LINE_CELL, TRIANGLE_CELL, 00123 QUADRILATERAL_CELL, POLYGON_CELL, TETRAHEDRON_CELL, HEXAHEDRON_CELL, 00124 QUADRATIC_EDGE_CELL, QUADRATIC_TRIANGLE_CELL, 00125 LAST_ITK_CELL, MAX_ITK_CELLS = 255} CellGeometryType; 00126 00132 itkSetEnumMacro(PointPixelType, IOPixelType); 00133 itkGetEnumMacro(PointPixelType, IOPixelType); 00134 itkSetEnumMacro(CellPixelType, IOPixelType); 00135 itkGetEnumMacro(CellPixelType, IOPixelType); 00137 00140 itkSetEnumMacro(PointComponentType, IOComponentType); 00141 itkGetEnumMacro(PointComponentType, IOComponentType); 00142 itkSetEnumMacro(CellComponentType, IOComponentType); 00143 itkGetEnumMacro(CellComponentType, IOComponentType); 00144 itkSetEnumMacro(PointPixelComponentType, IOComponentType); 00145 itkGetEnumMacro(PointPixelComponentType, IOComponentType); 00146 itkSetEnumMacro(CellPixelComponentType, IOComponentType); 00147 itkGetEnumMacro(CellPixelComponentType, IOComponentType); 00149 00150 template< typename T > 00151 struct MapComponentType { 00152 static const IOComponentType CType = UNKNOWNCOMPONENTTYPE; 00153 }; 00154 00155 template< typename T > 00156 void SetPixelType(const T & itkNotUsed(dummy), bool UsePointPixel = true) 00157 { 00158 if ( UsePointPixel ) 00159 { 00160 SetNumberOfPointPixelComponents(1); 00161 SetPointPixelComponentType(MapComponentType< T >::CType); 00162 SetPointPixelType(SCALAR); 00163 } 00164 else 00165 { 00166 SetNumberOfCellPixelComponents(1); 00167 SetCellPixelComponentType(MapComponentType< T >::CType); 00168 SetCellPixelType(SCALAR); 00169 } 00170 } 00171 00172 template< typename T > 00173 void SetPixelType(const RGBPixel< T > & itkNotUsed(dummy), bool UsePointPixel = true) 00174 { 00175 if ( UsePointPixel ) 00176 { 00177 SetNumberOfPointPixelComponents(3); 00178 SetPointPixelComponentType(MapComponentType< T >::CType); 00179 SetPointPixelType(RGB); 00180 } 00181 else 00182 { 00183 SetNumberOfCellPixelComponents(3); 00184 SetCellPixelComponentType(MapComponentType< T >::CType); 00185 SetCellPixelType(RGB); 00186 } 00187 } 00188 00189 template< typename T > 00190 void SetPixelType(const RGBAPixel< T > & itkNotUsed(dummy), bool UsePointPixel = true) 00191 { 00192 if ( UsePointPixel ) 00193 { 00194 SetNumberOfPointPixelComponents(4); 00195 SetPointPixelComponentType(MapComponentType< T >::CType); 00196 SetPointPixelType(RGBA); 00197 } 00198 else 00199 { 00200 SetNumberOfCellPixelComponents(4); 00201 SetCellPixelComponentType(MapComponentType< T >::CType); 00202 SetCellPixelType(RGBA); 00203 } 00204 } 00205 00206 template< typename T, unsigned int VLength > 00207 void SetPixelType(const Vector< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true) 00208 { 00209 if ( UsePointPixel ) 00210 { 00211 SetNumberOfPointPixelComponents(VLength); 00212 SetPointPixelComponentType(MapComponentType< T >::CType); 00213 SetPointPixelType(VECTOR); 00214 } 00215 else 00216 { 00217 SetNumberOfCellPixelComponents(VLength); 00218 SetCellPixelComponentType(MapComponentType< T >::CType); 00219 SetCellPixelType(VECTOR); 00220 } 00221 } 00222 00223 template< typename T, unsigned int VLength > 00224 void SetPixelType(const CovariantVector< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true) 00225 { 00226 if ( UsePointPixel ) 00227 { 00228 SetNumberOfPointPixelComponents(VLength); 00229 SetPointPixelComponentType(MapComponentType< T >::CType); 00230 SetPointPixelType(COVARIANTVECTOR); 00231 } 00232 else 00233 { 00234 SetNumberOfCellPixelComponents(VLength); 00235 SetCellPixelComponentType(MapComponentType< T >::CType); 00236 SetCellPixelType(COVARIANTVECTOR); 00237 } 00238 } 00239 00240 template< typename T, unsigned int VLength > 00241 void SetPixelType(const FixedArray< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true) 00242 { 00243 if ( UsePointPixel ) 00244 { 00245 SetNumberOfPointPixelComponents(VLength); 00246 SetPointPixelComponentType(MapComponentType< T >::CType); 00247 SetPointPixelType(FIXEDARRAY); 00248 } 00249 else 00250 { 00251 SetNumberOfCellPixelComponents(VLength); 00252 SetCellPixelComponentType(MapComponentType< T >::CType); 00253 SetCellPixelType(FIXEDARRAY); 00254 } 00255 } 00256 00257 template< typename T, unsigned int VLength > 00258 void SetPixelType(const SymmetricSecondRankTensor< T, VLength > itkNotUsed(dummy), bool UsePointPixel = true) 00259 { 00260 if ( UsePointPixel ) 00261 { 00262 SetNumberOfPointPixelComponents(VLength * ( VLength + 1 ) / 2); 00263 SetPointPixelComponentType(MapComponentType< T >::CType); 00264 SetPointPixelType(SYMMETRICSECONDRANKTENSOR); 00265 } 00266 else 00267 { 00268 SetNumberOfCellPixelComponents(VLength * ( VLength + 1 ) / 2); 00269 SetCellPixelComponentType(MapComponentType< T >::CType); 00270 SetCellPixelType(SYMMETRICSECONDRANKTENSOR); 00271 } 00272 } 00273 00274 template< typename T > 00275 void SetPixelType(const DiffusionTensor3D< T > & itkNotUsed(dummy), bool UsePointPixel = true) 00276 { 00277 if ( UsePointPixel ) 00278 { 00279 SetNumberOfPointPixelComponents(6); 00280 SetPointPixelComponentType(MapComponentType< T >::CType); 00281 SetPointPixelType(DIFFUSIONTENSOR3D); 00282 } 00283 else 00284 { 00285 SetNumberOfCellPixelComponents(6); 00286 SetCellPixelComponentType(MapComponentType< T >::CType); 00287 SetCellPixelType(DIFFUSIONTENSOR3D); 00288 } 00289 } 00290 00291 template< typename T, unsigned int NR, unsigned int NC > 00292 void SetPixelType(const Matrix< T, NR, NC > & itkNotUsed(dummy), bool UsePointPixel = true) 00293 { 00294 if ( UsePointPixel ) 00295 { 00296 SetNumberOfPointPixelComponents(NR * NC); 00297 SetPointPixelComponentType(MapComponentType< T >::CType); 00298 SetPointPixelType(MATRIX); 00299 } 00300 else 00301 { 00302 SetNumberOfCellPixelComponents(NR * NC); 00303 SetCellPixelComponentType(MapComponentType< T >::CType); 00304 SetCellPixelType(MATRIX); 00305 } 00306 } 00307 00308 template< typename T > 00309 void SetPixelType(const std::complex< T > & itkNotUsed(dummy), bool UsePointPixel = true) 00310 { 00311 if ( UsePointPixel ) 00312 { 00313 SetNumberOfPointPixelComponents(2); 00314 SetPointPixelComponentType(MapComponentType< T >::CType); 00315 SetPointPixelType(COMPLEX); 00316 } 00317 else 00318 { 00319 SetNumberOfCellPixelComponents(2); 00320 SetCellPixelComponentType(MapComponentType< T >::CType); 00321 SetCellPixelType(COMPLEX); 00322 } 00323 } 00324 00325 template< typename T > 00326 void SetPixelType(const Array< T > & array, bool UsePointPixel = true) 00327 { 00328 if ( UsePointPixel ) 00329 { 00330 SetNumberOfPointPixelComponents( array.Size() ); 00331 SetPointPixelComponentType(MapComponentType< T >::CType); 00332 SetPointPixelType(ARRAY); 00333 } 00334 else 00335 { 00336 SetNumberOfCellPixelComponents( array.Size() ); 00337 SetCellPixelComponentType(MapComponentType< T >::CType); 00338 SetCellPixelType(ARRAY); 00339 } 00340 } 00341 00342 template< typename T > 00343 void SetPixelType(const VariableLengthVector< T > & vector, bool UsePointPixel = true) 00344 { 00345 if ( UsePointPixel ) 00346 { 00347 SetNumberOfPointPixelComponents( vector.Size() ); 00348 SetPointPixelComponentType(MapComponentType< T >::CType); 00349 SetPointPixelType(VARIABLELENGTHVECTOR); 00350 } 00351 else 00352 { 00353 SetNumberOfCellPixelComponents( vector.Size() ); 00354 SetCellPixelComponentType(MapComponentType< T >::CType); 00355 SetCellPixelType(VARIABLELENGTHVECTOR); 00356 } 00357 } 00358 00359 template< typename T > 00360 void SetPixelType(const VariableSizeMatrix< T > & matrix, bool UsePointPixel = true) 00361 { 00362 if ( UsePointPixel ) 00363 { 00364 SetNumberOfPointPixelComponents( matrix.Rows() * matrix.Cols() ); 00365 SetPointPixelComponentType(MapComponentType< T >::CType); 00366 SetPointPixelType(VARIABLESIZEMATRIX); 00367 } 00368 else 00369 { 00370 SetNumberOfCellPixelComponents( matrix.Rows() * matrix.Cols() ); 00371 SetCellPixelComponentType(MapComponentType< T >::CType); 00372 SetCellPixelType(VARIABLESIZEMATRIX); 00373 } 00374 } 00375 00380 itkSetMacro(NumberOfPointPixelComponents, unsigned int); 00381 itkGetConstMacro(NumberOfPointPixelComponents, unsigned int); 00382 itkSetMacro(NumberOfCellPixelComponents, unsigned int); 00383 itkGetConstMacro(NumberOfCellPixelComponents, unsigned int); 00384 itkSetMacro(PointDimension, unsigned int); 00385 itkGetConstMacro(PointDimension, unsigned int); 00386 itkSetMacro(NumberOfPoints, SizeValueType); 00387 itkGetConstMacro(NumberOfPoints, SizeValueType); 00388 itkSetMacro(NumberOfCells, SizeValueType); 00389 itkGetConstMacro(NumberOfCells, SizeValueType); 00390 itkSetMacro(NumberOfPointPixels, SizeValueType); 00391 itkGetConstMacro(NumberOfPointPixels, SizeValueType); 00392 itkSetMacro(NumberOfCellPixels, SizeValueType); 00393 itkGetConstMacro(NumberOfCellPixels, SizeValueType); 00394 itkSetMacro(CellBufferSize, SizeValueType); 00395 itkGetConstMacro(CellBufferSize, SizeValueType); 00396 itkSetMacro(UpdatePoints, bool); 00397 itkGetConstMacro(UpdatePoints, bool); 00398 itkSetMacro(UpdateCells, bool); 00399 itkGetConstMacro(UpdateCells, bool); 00400 itkSetMacro(UpdatePointData, bool); 00401 itkGetConstMacro(UpdatePointData, bool); 00402 itkSetMacro(UpdateCellData, bool); 00403 itkGetConstMacro(UpdateCellData, bool); 00405 00406 unsigned int GetComponentSize(IOComponentType componentType) const; 00407 00410 std::string GetComponentTypeAsString(IOComponentType) const; 00411 00414 std::string GetPixelTypeAsString(IOPixelType) const; 00415 00418 itkSetEnumMacro(FileType, FileType); 00419 itkGetEnumMacro(FileType, FileType); 00421 00422 void SetFileTypeToASCII() 00423 { 00424 this->SetFileType(ASCII); 00425 } 00426 00427 void SetFileTypeToBinary() 00428 { 00429 this->SetFileType(BINARY); 00430 } 00431 00443 itkSetEnumMacro(ByteOrder, ByteOrder); 00444 itkGetEnumMacro(ByteOrder, ByteOrder); 00446 00447 void SetByteOrderToBigEndian() 00448 { 00449 this->SetByteOrder(BigEndian); 00450 } 00451 00452 void SetByteOrderToLittleEndian() 00453 { 00454 this->SetByteOrder(LittleEndian); 00455 } 00456 00458 itkSetMacro(UseCompression, bool); 00459 itkGetConstMacro(UseCompression, bool); 00460 itkBooleanMacro(UseCompression); 00462 00465 std::string GetFileTypeAsString(FileType) const; 00466 00469 std::string GetByteOrderAsString(ByteOrder) const; 00470 00471 /*-------- This part of the interfaces deals with reading data ----- */ 00474 virtual bool CanReadFile(const char *) = 0; 00475 00478 virtual void ReadMeshInformation() = 0; 00479 00481 virtual void ReadPoints(void *buffer) = 0; 00482 00483 virtual void ReadCells(void *buffer) = 0; 00484 00485 virtual void ReadPointData(void *buffer) = 0; 00486 00487 virtual void ReadCellData(void *buffer) = 0; 00488 00489 /*-------- This part of the interfaces deals with writing data ----- */ 00490 00493 virtual bool CanWriteFile(const char *) = 0; 00494 00495 virtual void WriteMeshInformation() = 0; 00496 00497 virtual void WritePoints(void *buffer) = 0; 00498 00499 virtual void WriteCells(void *buffer) = 0; 00500 00501 virtual void WritePointData(void *buffer) = 0; 00502 00503 virtual void WriteCellData(void *buffer) = 0; 00504 00505 virtual void Write() = 0; 00506 00511 const ArrayOfExtensionsType & GetSupportedReadExtensions() const; 00512 00517 const ArrayOfExtensionsType & GetSupportedWriteExtensions() const; 00518 00519 protected: 00520 MeshIOBase(); 00521 virtual ~MeshIOBase(){} 00522 00523 void PrintSelf(std::ostream & os, Indent indent) const; 00524 00526 void AddSupportedReadExtension(const char *extension); 00527 00529 void AddSupportedWriteExtension(const char *extension); 00530 00532 template< class T > 00533 void ReadBufferAsAscii(T *buffer, std::ifstream & inputFile, SizeValueType numberOfComponents) 00534 { 00535 for ( SizeValueType i = 0; i < numberOfComponents; i++ ) 00536 { 00537 inputFile >> buffer[i]; 00538 } 00539 } 00541 00543 template< class T > 00544 void ReadBufferAsBinary(T *buffer, std::ifstream & inputFile, SizeValueType numberOfComponents) 00545 { 00546 inputFile.read( reinterpret_cast< char * >( buffer ), numberOfComponents * sizeof( T ) ); 00547 00548 if ( m_ByteOrder == BigEndian ) 00549 { 00550 if ( itk::ByteSwapper< T >::SystemIsLittleEndian() ) 00551 { 00552 itk::ByteSwapper< T >::SwapRangeFromSystemToBigEndian(buffer, numberOfComponents); 00553 } 00554 } 00555 else if ( m_ByteOrder == LittleEndian ) 00556 { 00557 if ( itk::ByteSwapper< T >::SystemIsBigEndian() ) 00558 { 00559 itk::ByteSwapper< T >::SwapRangeFromSystemToLittleEndian(buffer, numberOfComponents); 00560 } 00561 } 00562 } 00563 00565 template< class T > 00566 void WriteBufferAsAscii(T *buffer, std::ofstream & outputFile, SizeValueType numberOfLines, SizeValueType numberOfComponents) 00567 { 00568 for ( SizeValueType ii = 0; ii < numberOfLines; ii++ ) 00569 { 00570 for ( SizeValueType jj = 0; jj < numberOfComponents; jj++ ) 00571 { 00572 outputFile << buffer[ii * numberOfComponents + jj] << " "; 00573 } 00574 outputFile << '\n'; 00575 } 00576 } 00578 00580 template< class TOutput, class TInput > 00581 void WriteBufferAsBinary(TInput *buffer, std::ofstream & outputFile, SizeValueType numberOfComponents) 00582 { 00583 if ( typeid( TInput ) == typeid( TOutput ) ) 00584 { 00585 if ( m_ByteOrder == BigEndian && itk::ByteSwapper< TInput >::SystemIsLittleEndian() ) 00586 { 00587 itk::ByteSwapper< TInput >::SwapRangeFromSystemToBigEndian(buffer, numberOfComponents); 00588 } 00589 else if ( m_ByteOrder == LittleEndian && itk::ByteSwapper< TInput >::SystemIsBigEndian() ) 00590 { 00591 itk::ByteSwapper< TInput >::SwapRangeFromSystemToLittleEndian(buffer, numberOfComponents); 00592 } 00594 00595 outputFile.write(reinterpret_cast< char * >( buffer ), numberOfComponents); 00596 } 00597 else 00598 { 00599 TOutput *data = new TOutput[numberOfComponents]; 00600 for ( SizeValueType ii = 0; ii < numberOfComponents; ii++ ) 00601 { 00602 data[ii] = static_cast< TOutput >( buffer[ii] ); 00603 } 00604 00605 if ( m_ByteOrder == BigEndian && itk::ByteSwapper< TOutput >::SystemIsLittleEndian() ) 00606 { 00607 itk::ByteSwapper< TOutput >::SwapRangeFromSystemToBigEndian(data, numberOfComponents); 00608 } 00609 else if ( m_ByteOrder == LittleEndian && itk::ByteSwapper< TOutput >::SystemIsBigEndian() ) 00610 { 00611 itk::ByteSwapper< TOutput >::SwapRangeFromSystemToLittleEndian(data, numberOfComponents); 00612 } 00613 00614 outputFile.write(reinterpret_cast< char * >( data ), numberOfComponents); 00615 } 00616 } 00617 00621 template< class TInput, class TOutput > 00622 void ReadCellsBuffer(TInput *input, TOutput *output) 00623 { 00624 if ( input && output ) 00625 { 00626 SizeValueType inputIndex = NumericTraits< SizeValueType >::Zero; 00627 SizeValueType outputIndex = NumericTraits< SizeValueType >::Zero; 00628 for ( SizeValueType ii = 0; ii < m_NumberOfCells; ii++ ) 00629 { 00630 inputIndex++; // ignore the cell type 00631 unsigned int numberOfPoints = static_cast< unsigned int >( input[inputIndex++] ); 00632 for ( unsigned int jj = 0; jj < numberOfPoints; jj++ ) 00633 { 00634 output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] ); 00635 } 00636 } 00637 } 00638 } 00640 00644 template< class TInput, class TOutput > 00645 void ReadCellsBuffer(TInput *input, TOutput *output, MeshIOBase::CellGeometryType type) 00646 { 00647 if ( input && output ) 00648 { 00649 SizeValueType inputIndex = itk::NumericTraits< SizeValueType >::Zero; 00650 SizeValueType outputIndex = itk::NumericTraits< SizeValueType >::Zero; 00652 00653 for ( SizeValueType ii = 0; ii < m_NumberOfCells; ii++ ) 00654 { 00655 MeshIOBase::CellGeometryType cellType = static_cast< MeshIOBase::CellGeometryType >( input[inputIndex++] ); 00656 unsigned int nn = static_cast< unsigned int >( input[inputIndex++] ); 00657 if ( cellType == type ) 00658 { 00659 output[outputIndex++] = nn; 00660 for ( unsigned int jj = 0; jj < nn; jj++ ) 00661 { 00662 output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] ); 00663 } 00664 } 00665 else 00666 { 00667 inputIndex += nn; 00668 } 00669 } 00670 } 00671 } 00672 00675 template< class TInput, class TOutput > 00676 void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, unsigned int numberOfPoints, SizeValueType numberOfCells) 00677 { 00678 if ( input && output ) 00679 { 00680 SizeValueType inputIndex = NumericTraits< SizeValueType >::Zero; 00681 SizeValueType outputIndex = NumericTraits< SizeValueType >::Zero; 00682 for ( SizeValueType ii = 0; ii < numberOfCells; ii++ ) 00683 { 00684 output[outputIndex++] = static_cast< TOutput >( cellType ); 00685 output[outputIndex++] = static_cast< TOutput >( numberOfPoints ); 00686 for ( unsigned int jj = 0; jj < numberOfPoints; jj++ ) 00687 { 00688 output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] ); 00689 } 00690 } 00691 } 00692 } 00694 00697 template< class TInput, class TOutput > 00698 void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, SizeValueType numberOfCells) 00699 { 00700 if ( input && output ) 00701 { 00702 SizeValueType inputIndex = NumericTraits< SizeValueType >::Zero; 00703 SizeValueType outputIndex = NumericTraits< SizeValueType >::Zero; 00704 for ( SizeValueType ii = 0; ii < numberOfCells; ii++ ) 00705 { 00706 unsigned int numberOfPoints = static_cast< unsigned int >( input[inputIndex++] ); 00707 output[outputIndex++] = static_cast< TOutput >( cellType ); 00708 output[outputIndex++] = static_cast< TOutput >( numberOfPoints ); 00709 for ( unsigned int jj = 0; jj < numberOfPoints; jj++ ) 00710 { 00711 output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] ); 00712 } 00713 } 00714 } 00715 } 00717 00718 protected: 00720 ByteOrder m_ByteOrder; 00721 FileType m_FileType; 00722 00724 std::string m_FileName; 00725 00727 bool m_UseCompression; 00728 00730 IOComponentType m_PointComponentType; 00731 IOComponentType m_CellComponentType; 00732 IOComponentType m_PointPixelComponentType; 00733 IOComponentType m_CellPixelComponentType; 00734 00736 IOPixelType m_PointPixelType; 00737 IOPixelType m_CellPixelType; 00738 00741 unsigned int m_NumberOfPointPixelComponents; 00742 unsigned int m_NumberOfCellPixelComponents; 00743 00745 unsigned int m_PointDimension; 00746 00748 SizeValueType m_NumberOfPoints; 00749 SizeValueType m_NumberOfCells; 00750 SizeValueType m_NumberOfPointPixels; 00751 SizeValueType m_NumberOfCellPixels; 00752 00754 SizeValueType m_CellBufferSize; 00755 00758 bool m_UpdatePoints; 00759 bool m_UpdateCells; 00760 bool m_UpdatePointData; 00761 bool m_UpdateCellData; 00762 00763 private: 00764 MeshIOBase(const Self &); // purposely not implemented 00765 void operator=(const Self &); // purposely not implemented 00766 00767 ArrayOfExtensionsType m_SupportedReadExtensions; 00768 ArrayOfExtensionsType m_SupportedWriteExtensions; 00769 }; 00770 #define MESHIOBASE_TYPEMAP(type, ctype) \ 00771 template< > \ 00772 struct MeshIOBase:: MapComponentType< type > \ 00773 { \ 00774 static const IOComponentType CType = ctype; \ 00775 } 00776 00777 MESHIOBASE_TYPEMAP(unsigned char, UCHAR); 00778 MESHIOBASE_TYPEMAP(char, CHAR); 00779 MESHIOBASE_TYPEMAP(unsigned short, USHORT); 00780 MESHIOBASE_TYPEMAP(short, SHORT); 00781 MESHIOBASE_TYPEMAP(unsigned int, UINT); 00782 MESHIOBASE_TYPEMAP(int, INT); 00783 MESHIOBASE_TYPEMAP(unsigned long, ULONG); 00784 MESHIOBASE_TYPEMAP(long, LONG); 00785 MESHIOBASE_TYPEMAP(unsigned long long, ULONGLONG); 00786 MESHIOBASE_TYPEMAP(long long, LONGLONG); 00787 MESHIOBASE_TYPEMAP(float, FLOAT); 00788 MESHIOBASE_TYPEMAP(double, DOUBLE); 00789 MESHIOBASE_TYPEMAP(long double, LDOUBLE); 00790 #undef MESHIOBASE_TYPEMAP 00791 } // end namespace itk 00792 00793 #endif 00794