ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkMeshIOBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkMeshIOBase_h
19 #define itkMeshIOBase_h
20 #include "ITKIOMeshExport.h"
21 
22 #include "itkByteSwapper.h"
23 #include "itkCellInterface.h"
24 #include "itkCovariantVector.h"
25 #include "itkDiffusionTensor3D.h"
26 #include "itkIntTypes.h"
27 #include "itkLightProcessObject.h"
28 #include "itkMatrix.h"
29 #include "itkRGBPixel.h"
30 #include "itkRGBAPixel.h"
33 #include "itkVariableSizeMatrix.h"
34 #include "itkVector.h"
35 #include "itkNumberToString.h"
36 
37 #include <string>
38 #include <complex>
39 #include <fstream>
40 
41 namespace itk
42 {
69 class ITKIOMesh_EXPORT MeshIOBase:public LightProcessObject
70 {
71 public:
73  typedef MeshIOBase Self;
77 
79  typedef std::vector< std::string > ArrayOfExtensionsType;
80 
82  typedef std::streamoff StreamOffsetType;
83 
85 
91  class UnknownType {};
92 
94  itkTypeMacro(MeshIOBase, LightProcessObject);
95 
97  itkSetStringMacro(FileName);
98  itkGetStringMacro(FileName);
100 
104  typedef enum {UNKNOWNPIXELTYPE, SCALAR, RGB, RGBA, OFFSET, VECTOR,
105  POINT, COVARIANTVECTOR, SYMMETRICSECONDRANKTENSOR,
106  DIFFUSIONTENSOR3D, COMPLEX, FIXEDARRAY, ARRAY, MATRIX,
107  VARIABLELENGTHVECTOR, VARIABLESIZEMATRIX} IOPixelType;
108 
112  typedef enum {UNKNOWNCOMPONENTTYPE, UCHAR, CHAR, USHORT, SHORT, UINT, INT,
113  ULONG, LONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LDOUBLE} IOComponentType;
114 
117  typedef enum {ASCII, BINARY, TYPENOTAPPLICABLE} FileType;
118 
121  typedef enum {BigEndian, LittleEndian, OrderNotApplicable} ByteOrder;
122 
124  typedef enum {VERTEX_CELL = 0, LINE_CELL, TRIANGLE_CELL,
125  QUADRILATERAL_CELL, POLYGON_CELL, TETRAHEDRON_CELL, HEXAHEDRON_CELL,
126  QUADRATIC_EDGE_CELL, QUADRATIC_TRIANGLE_CELL,
127  LAST_ITK_CELL, MAX_ITK_CELLS = 255} CellGeometryType;
128 
134  itkSetEnumMacro(PointPixelType, IOPixelType);
135  itkGetEnumMacro(PointPixelType, IOPixelType);
136  itkSetEnumMacro(CellPixelType, IOPixelType);
137  itkGetEnumMacro(CellPixelType, IOPixelType);
139 
142  itkSetEnumMacro(PointComponentType, IOComponentType);
143  itkGetEnumMacro(PointComponentType, IOComponentType);
144  itkSetEnumMacro(CellComponentType, IOComponentType);
145  itkGetEnumMacro(CellComponentType, IOComponentType);
146  itkSetEnumMacro(PointPixelComponentType, IOComponentType);
147  itkGetEnumMacro(PointPixelComponentType, IOComponentType);
148  itkSetEnumMacro(CellPixelComponentType, IOComponentType);
149  itkGetEnumMacro(CellPixelComponentType, IOComponentType);
151 
152  template< typename T >
154  static const IOComponentType CType = UNKNOWNCOMPONENTTYPE;
155  };
156 
157  template< typename T >
158  void SetPixelType(const T & itkNotUsed(dummy), bool UsePointPixel = true)
159  {
160  if ( UsePointPixel )
161  {
162  SetNumberOfPointPixelComponents(1);
163  SetPointPixelComponentType(MapComponentType< T >::CType);
164  SetPointPixelType(SCALAR);
165  }
166  else
167  {
168  SetNumberOfCellPixelComponents(1);
169  SetCellPixelComponentType(MapComponentType< T >::CType);
170  SetCellPixelType(SCALAR);
171  }
172  }
173 
174  template< typename T >
175  void SetPixelType(const RGBPixel< T > & itkNotUsed(dummy), bool UsePointPixel = true)
176  {
177  if ( UsePointPixel )
178  {
179  SetNumberOfPointPixelComponents(3);
180  SetPointPixelComponentType(MapComponentType< T >::CType);
181  SetPointPixelType(RGB);
182  }
183  else
184  {
185  SetNumberOfCellPixelComponents(3);
186  SetCellPixelComponentType(MapComponentType< T >::CType);
187  SetCellPixelType(RGB);
188  }
189  }
190 
191  template< typename T >
192  void SetPixelType(const RGBAPixel< T > & itkNotUsed(dummy), bool UsePointPixel = true)
193  {
194  if ( UsePointPixel )
195  {
196  SetNumberOfPointPixelComponents(4);
197  SetPointPixelComponentType(MapComponentType< T >::CType);
198  SetPointPixelType(RGBA);
199  }
200  else
201  {
202  SetNumberOfCellPixelComponents(4);
203  SetCellPixelComponentType(MapComponentType< T >::CType);
204  SetCellPixelType(RGBA);
205  }
206  }
207 
208  template< typename T, unsigned int VLength >
209  void SetPixelType(const Vector< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true)
210  {
211  if ( UsePointPixel )
212  {
213  SetNumberOfPointPixelComponents(VLength);
214  SetPointPixelComponentType(MapComponentType< T >::CType);
215  SetPointPixelType(VECTOR);
216  }
217  else
218  {
219  SetNumberOfCellPixelComponents(VLength);
220  SetCellPixelComponentType(MapComponentType< T >::CType);
221  SetCellPixelType(VECTOR);
222  }
223  }
224 
225  template< typename T, unsigned int VLength >
226  void SetPixelType(const CovariantVector< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true)
227  {
228  if ( UsePointPixel )
229  {
230  SetNumberOfPointPixelComponents(VLength);
231  SetPointPixelComponentType(MapComponentType< T >::CType);
232  SetPointPixelType(COVARIANTVECTOR);
233  }
234  else
235  {
236  SetNumberOfCellPixelComponents(VLength);
237  SetCellPixelComponentType(MapComponentType< T >::CType);
238  SetCellPixelType(COVARIANTVECTOR);
239  }
240  }
241 
242  template< typename T, unsigned int VLength >
243  void SetPixelType(const FixedArray< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true)
244  {
245  if ( UsePointPixel )
246  {
247  SetNumberOfPointPixelComponents(VLength);
248  SetPointPixelComponentType(MapComponentType< T >::CType);
249  SetPointPixelType(FIXEDARRAY);
250  }
251  else
252  {
253  SetNumberOfCellPixelComponents(VLength);
254  SetCellPixelComponentType(MapComponentType< T >::CType);
255  SetCellPixelType(FIXEDARRAY);
256  }
257  }
258 
259  template< typename T, unsigned int VLength >
260  void SetPixelType(const SymmetricSecondRankTensor< T, VLength > itkNotUsed(dummy), bool UsePointPixel = true)
261  {
262  if ( UsePointPixel )
263  {
264  SetNumberOfPointPixelComponents(VLength * ( VLength + 1 ) / 2);
265  SetPointPixelComponentType(MapComponentType< T >::CType);
266  SetPointPixelType(SYMMETRICSECONDRANKTENSOR);
267  }
268  else
269  {
270  SetNumberOfCellPixelComponents(VLength * ( VLength + 1 ) / 2);
271  SetCellPixelComponentType(MapComponentType< T >::CType);
272  SetCellPixelType(SYMMETRICSECONDRANKTENSOR);
273  }
274  }
275 
276  template< typename T >
277  void SetPixelType(const DiffusionTensor3D< T > & itkNotUsed(dummy), bool UsePointPixel = true)
278  {
279  if ( UsePointPixel )
280  {
281  SetNumberOfPointPixelComponents(6);
282  SetPointPixelComponentType(MapComponentType< T >::CType);
283  SetPointPixelType(DIFFUSIONTENSOR3D);
284  }
285  else
286  {
287  SetNumberOfCellPixelComponents(6);
288  SetCellPixelComponentType(MapComponentType< T >::CType);
289  SetCellPixelType(DIFFUSIONTENSOR3D);
290  }
291  }
292 
293  template< typename T, unsigned int NR, unsigned int NC >
294  void SetPixelType(const Matrix< T, NR, NC > & itkNotUsed(dummy), bool UsePointPixel = true)
295  {
296  if ( UsePointPixel )
297  {
298  SetNumberOfPointPixelComponents(NR * NC);
299  SetPointPixelComponentType(MapComponentType< T >::CType);
300  SetPointPixelType(MATRIX);
301  }
302  else
303  {
304  SetNumberOfCellPixelComponents(NR * NC);
305  SetCellPixelComponentType(MapComponentType< T >::CType);
306  SetCellPixelType(MATRIX);
307  }
308  }
309 
310  template< typename T >
311  void SetPixelType(const std::complex< T > & itkNotUsed(dummy), bool UsePointPixel = true)
312  {
313  if ( UsePointPixel )
314  {
315  SetNumberOfPointPixelComponents(2);
316  SetPointPixelComponentType(MapComponentType< T >::CType);
317  SetPointPixelType(COMPLEX);
318  }
319  else
320  {
321  SetNumberOfCellPixelComponents(2);
322  SetCellPixelComponentType(MapComponentType< T >::CType);
323  SetCellPixelType(COMPLEX);
324  }
325  }
326 
327  template< typename T >
328  void SetPixelType(const Array< T > & array, bool UsePointPixel = true)
329  {
330  if ( UsePointPixel )
331  {
332  SetNumberOfPointPixelComponents( array.Size() );
333  SetPointPixelComponentType(MapComponentType< T >::CType);
334  SetPointPixelType(ARRAY);
335  }
336  else
337  {
338  SetNumberOfCellPixelComponents( array.Size() );
339  SetCellPixelComponentType(MapComponentType< T >::CType);
340  SetCellPixelType(ARRAY);
341  }
342  }
343 
344  template< typename T >
345  void SetPixelType(const VariableLengthVector< T > & vector, bool UsePointPixel = true)
346  {
347  if ( UsePointPixel )
348  {
349  SetNumberOfPointPixelComponents( vector.Size() );
350  SetPointPixelComponentType(MapComponentType< T >::CType);
351  SetPointPixelType(VARIABLELENGTHVECTOR);
352  }
353  else
354  {
355  SetNumberOfCellPixelComponents( vector.Size() );
356  SetCellPixelComponentType(MapComponentType< T >::CType);
357  SetCellPixelType(VARIABLELENGTHVECTOR);
358  }
359  }
360 
361  template< typename T >
362  void SetPixelType(const VariableSizeMatrix< T > & matrix, bool UsePointPixel = true)
363  {
364  if ( UsePointPixel )
365  {
366  SetNumberOfPointPixelComponents( matrix.Rows() * matrix.Cols() );
367  SetPointPixelComponentType(MapComponentType< T >::CType);
368  SetPointPixelType(VARIABLESIZEMATRIX);
369  }
370  else
371  {
372  SetNumberOfCellPixelComponents( matrix.Rows() * matrix.Cols() );
373  SetCellPixelComponentType(MapComponentType< T >::CType);
374  SetCellPixelType(VARIABLESIZEMATRIX);
375  }
376  }
377 
382  itkSetMacro(NumberOfPointPixelComponents, unsigned int);
383  itkGetConstMacro(NumberOfPointPixelComponents, unsigned int);
384  itkSetMacro(NumberOfCellPixelComponents, unsigned int);
385  itkGetConstMacro(NumberOfCellPixelComponents, unsigned int);
386  itkSetMacro(PointDimension, unsigned int);
387  itkGetConstMacro(PointDimension, unsigned int);
388  itkSetMacro(NumberOfPoints, SizeValueType);
389  itkGetConstMacro(NumberOfPoints, SizeValueType);
390  itkSetMacro(NumberOfCells, SizeValueType);
391  itkGetConstMacro(NumberOfCells, SizeValueType);
392  itkSetMacro(NumberOfPointPixels, SizeValueType);
393  itkGetConstMacro(NumberOfPointPixels, SizeValueType);
394  itkSetMacro(NumberOfCellPixels, SizeValueType);
395  itkGetConstMacro(NumberOfCellPixels, SizeValueType);
396  itkSetMacro(CellBufferSize, SizeValueType);
397  itkGetConstMacro(CellBufferSize, SizeValueType);
398  itkSetMacro(UpdatePoints, bool);
399  itkGetConstMacro(UpdatePoints, bool);
400  itkSetMacro(UpdateCells, bool);
401  itkGetConstMacro(UpdateCells, bool);
402  itkSetMacro(UpdatePointData, bool);
403  itkGetConstMacro(UpdatePointData, bool);
404  itkSetMacro(UpdateCellData, bool);
405  itkGetConstMacro(UpdateCellData, bool);
407 
408  unsigned int GetComponentSize(IOComponentType componentType) const;
409 
412  std::string GetComponentTypeAsString(IOComponentType) const;
413 
416  std::string GetPixelTypeAsString(IOPixelType) const;
417 
420  itkSetEnumMacro(FileType, FileType);
421  itkGetEnumMacro(FileType, FileType);
423 
425  {
426  this->SetFileType(ASCII);
427  }
428 
430  {
431  this->SetFileType(BINARY);
432  }
433 
445  itkSetEnumMacro(ByteOrder, ByteOrder);
446  itkGetEnumMacro(ByteOrder, ByteOrder);
448 
450  {
451  this->SetByteOrder(BigEndian);
452  }
453 
455  {
456  this->SetByteOrder(LittleEndian);
457  }
458 
460  itkSetMacro(UseCompression, bool);
461  itkGetConstMacro(UseCompression, bool);
462  itkBooleanMacro(UseCompression);
464 
467  std::string GetFileTypeAsString(FileType) const;
468 
471  std::string GetByteOrderAsString(ByteOrder) const;
472 
473  /*-------- This part of the interfaces deals with reading data ----- */
476  virtual bool CanReadFile(const char *) = 0;
477 
480  virtual void ReadMeshInformation() = 0;
481 
483  virtual void ReadPoints(void *buffer) = 0;
484 
485  virtual void ReadCells(void *buffer) = 0;
486 
487  virtual void ReadPointData(void *buffer) = 0;
488 
489  virtual void ReadCellData(void *buffer) = 0;
490 
491  /*-------- This part of the interfaces deals with writing data ----- */
492 
495  virtual bool CanWriteFile(const char *) = 0;
496 
497  virtual void WriteMeshInformation() = 0;
498 
499  virtual void WritePoints(void *buffer) = 0;
500 
501  virtual void WriteCells(void *buffer) = 0;
502 
503  virtual void WritePointData(void *buffer) = 0;
504 
505  virtual void WriteCellData(void *buffer) = 0;
506 
507  virtual void Write() = 0;
508 
513  const ArrayOfExtensionsType & GetSupportedReadExtensions() const;
514 
519  const ArrayOfExtensionsType & GetSupportedWriteExtensions() const;
520 
521 protected:
522  MeshIOBase();
523  virtual ~MeshIOBase(){}
524 
525  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
526 
528  void AddSupportedReadExtension(const char *extension);
529 
531  void AddSupportedWriteExtension(const char *extension);
532 
534  template< typename T >
535  void ReadBufferAsAscii(T *buffer, std::ifstream & inputFile, SizeValueType numberOfComponents)
536  {
537  for ( SizeValueType i = 0; i < numberOfComponents; i++ )
538  {
539  inputFile >> buffer[i];
540  }
541  }
543 
545  template< typename T >
546  void ReadBufferAsBinary(T *buffer, std::ifstream & inputFile, SizeValueType numberOfComponents)
547  {
548  inputFile.read( reinterpret_cast< char * >( buffer ), numberOfComponents * sizeof( T ) );
549 
550  if ( m_ByteOrder == BigEndian )
551  {
553  {
554  itk::ByteSwapper< T >::SwapRangeFromSystemToBigEndian(buffer, numberOfComponents);
555  }
556  }
557  else if ( m_ByteOrder == LittleEndian )
558  {
560  {
562  }
563  }
564  }
565 
567  template< typename T >
568  void WriteBufferAsAscii(T *buffer, std::ofstream & outputFile, SizeValueType numberOfLines, SizeValueType numberOfComponents)
569  {
570  NumberToString<T> convert;
571  for ( SizeValueType ii = 0; ii < numberOfLines; ii++ )
572  {
573  for ( SizeValueType jj = 0; jj < numberOfComponents; jj++ )
574  {
575  outputFile << convert(buffer[ii * numberOfComponents + jj]) << " ";
576  }
577  outputFile << '\n';
578  }
579  }
581 
583  template< typename TOutput, typename TInput >
584  void WriteBufferAsBinary(TInput *buffer, std::ofstream & outputFile, SizeValueType numberOfComponents)
585  {
586  if ( typeid( TInput ) == typeid( TOutput ) )
587  {
588  if ( m_ByteOrder == BigEndian && itk::ByteSwapper< TInput >::SystemIsLittleEndian() )
589  {
591  }
592  else if ( m_ByteOrder == LittleEndian && itk::ByteSwapper< TInput >::SystemIsBigEndian() )
593  {
595  }
597 
598  outputFile.write(reinterpret_cast< char * >( buffer ), numberOfComponents);
599  }
600  else
601  {
602  TOutput *data = new TOutput[numberOfComponents];
603  for ( SizeValueType ii = 0; ii < numberOfComponents; ii++ )
604  {
605  data[ii] = static_cast< TOutput >( buffer[ii] );
606  }
607 
608  if ( m_ByteOrder == BigEndian && itk::ByteSwapper< TOutput >::SystemIsLittleEndian() )
609  {
611  }
612  else if ( m_ByteOrder == LittleEndian && itk::ByteSwapper< TOutput >::SystemIsBigEndian() )
613  {
615  }
616 
617  outputFile.write(reinterpret_cast< char * >( data ), numberOfComponents);
618  delete[] data;
619  }
620  }
621 
625  template< typename TInput, typename TOutput >
626  void ReadCellsBuffer(TInput *input, TOutput *output)
627  {
628  if ( input && output )
629  {
632  for ( SizeValueType ii = 0; ii < m_NumberOfCells; ii++ )
633  {
634  inputIndex++; // ignore the cell type
635  unsigned int numberOfPoints = static_cast< unsigned int >( input[inputIndex++] );
636  for ( unsigned int jj = 0; jj < numberOfPoints; jj++ )
637  {
638  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
639  }
640  }
641  }
642  }
644 
648  template< typename TInput, typename TOutput >
649  void ReadCellsBuffer(TInput *input, TOutput *output, MeshIOBase::CellGeometryType type)
650  {
651  if ( input && output )
652  {
656 
657  for ( SizeValueType ii = 0; ii < m_NumberOfCells; ii++ )
658  {
659  MeshIOBase::CellGeometryType cellType = static_cast< MeshIOBase::CellGeometryType >( input[inputIndex++] );
660  unsigned int nn = static_cast< unsigned int >( input[inputIndex++] );
661  if ( cellType == type )
662  {
663  output[outputIndex++] = nn;
664  for ( unsigned int jj = 0; jj < nn; jj++ )
665  {
666  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
667  }
668  }
669  else
670  {
671  inputIndex += nn;
672  }
673  }
674  }
675  }
676 
679  template< typename TInput, typename TOutput >
680  void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, unsigned int numberOfPoints, SizeValueType numberOfCells)
681  {
682  if ( input && output )
683  {
686  for ( SizeValueType ii = 0; ii < numberOfCells; ii++ )
687  {
688  output[outputIndex++] = static_cast< TOutput >( cellType );
689  output[outputIndex++] = static_cast< TOutput >( numberOfPoints );
690  for ( unsigned int jj = 0; jj < numberOfPoints; jj++ )
691  {
692  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
693  }
694  }
695  }
696  }
698 
701  template< typename TInput, typename TOutput >
702  void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, SizeValueType numberOfCells)
703  {
704  if ( input && output )
705  {
708  for ( SizeValueType ii = 0; ii < numberOfCells; ii++ )
709  {
710  unsigned int numberOfPoints = static_cast< unsigned int >( input[inputIndex++] );
711  output[outputIndex++] = static_cast< TOutput >( cellType );
712  output[outputIndex++] = static_cast< TOutput >( numberOfPoints );
713  for ( unsigned int jj = 0; jj < numberOfPoints; jj++ )
714  {
715  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
716  }
717  }
718  }
719  }
721 
722 protected:
726 
728  std::string m_FileName;
729 
732 
738 
742 
747 
750 
756 
759 
766 
767 private:
768  MeshIOBase(const Self &) ITK_DELETE_FUNCTION;
769  void operator=(const Self &) ITK_DELETE_FUNCTION;
770 
771  ArrayOfExtensionsType m_SupportedReadExtensions;
772  ArrayOfExtensionsType m_SupportedWriteExtensions;
773 };
774 #define MESHIOBASE_TYPEMAP(type, ctype) \
775  template< > \
776  struct MeshIOBase:: MapComponentType< type > \
777  { \
778  static const IOComponentType CType = ctype; \
779  }
780 
781 MESHIOBASE_TYPEMAP(unsigned char, UCHAR);
782 MESHIOBASE_TYPEMAP(char, CHAR);
783 MESHIOBASE_TYPEMAP(unsigned short, USHORT);
784 MESHIOBASE_TYPEMAP(short, SHORT);
785 MESHIOBASE_TYPEMAP(unsigned int, UINT);
786 MESHIOBASE_TYPEMAP(int, INT);
787 MESHIOBASE_TYPEMAP(unsigned long, ULONG);
788 MESHIOBASE_TYPEMAP(long, LONG);
789 MESHIOBASE_TYPEMAP(unsigned long long, ULONGLONG);
790 MESHIOBASE_TYPEMAP(long long, LONGLONG);
791 MESHIOBASE_TYPEMAP(float, FLOAT);
792 MESHIOBASE_TYPEMAP(double, DOUBLE);
793 MESHIOBASE_TYPEMAP(long double, LDOUBLE);
794 #undef MESHIOBASE_TYPEMAP
795 } // end namespace itk
796 
797 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
void SetByteOrderToLittleEndian()
SizeValueType m_NumberOfCells
SmartPointer< const Self > ConstPointer
Definition: itkMeshIOBase.h:75
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:47
unsigned int m_NumberOfPointPixelComponents
unsigned int Rows() const
Light weight base class for most itk classes.
void ReadCellsBuffer(TInput *input, TOutput *output)
SizeValueType m_NumberOfPoints
SizeValueType m_CellBufferSize
void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, unsigned int numberOfPoints, SizeValueType numberOfCells)
std::streamoff StreamOffsetType
Definition: itkMeshIOBase.h:82
IOComponentType m_PointComponentType
Represent Red, Green, Blue and Alpha components for color images.
Definition: itkRGBAPixel.h:59
Represent a symmetric tensor of second rank.
void SetPixelType(const Array< T > &array, bool UsePointPixel=true)
A templated class holding a M x N size Matrix.
void SetPixelType(const RGBAPixel< T > &, bool UsePointPixel=true)
IOComponentType m_CellComponentType
void SetPixelType(const DiffusionTensor3D< T > &, bool UsePointPixel=true)
*brief Mask an image with the negative of a mask **This class is templated over the types of the *input image type
void WriteBufferAsAscii(T *buffer, std::ofstream &outputFile, SizeValueType numberOfLines, SizeValueType numberOfComponents)
IOComponentType m_PointPixelComponentType
const char *const NR
unsigned int Cols() const
IdentifierType SizeValueType
Definition: itkMeshIOBase.h:84
void SetFileTypeToASCII()
void SetPixelType(const Matrix< T, NR, NC > &, bool UsePointPixel=true)
SizeValueType m_NumberOfCellPixels
void SetPixelType(const RGBPixel< T > &, bool UsePointPixel=true)
unsigned long SizeValueType
Definition: itkIntTypes.h:143
void SetPixelType(const SymmetricSecondRankTensor< T, VLength >, bool UsePointPixel=true)
void ReadBufferAsAscii(T *buffer, std::ifstream &inputFile, SizeValueType numberOfComponents)
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:50
unsigned int Size(void) const noexcept
void SetPixelType(const Vector< T, VLength > &, bool UsePointPixel=true)
static void SwapRangeFromSystemToBigEndian(T *p, BufferSizeType num)
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
void SetPixelType(const FixedArray< T, VLength > &, bool UsePointPixel=true)
Represents an array whose length can be defined at run-time.
Convert floating and fixed point numbers to strings.
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
void SetPixelType(const VariableSizeMatrix< T > &matrix, bool UsePointPixel=true)
void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, SizeValueType numberOfCells)
void SetFileTypeToBinary()
static void SwapRangeFromSystemToLittleEndian(T *p, BufferSizeType num)
SizeValueType m_NumberOfPointPixels
IOPixelType m_CellPixelType
LightProcessObject Superclass
Definition: itkMeshIOBase.h:74
MESHIOBASE_TYPEMAP(unsigned char, UCHAR)
SmartPointer< Self > Pointer
Definition: itkMeshIOBase.h:76
void ReadCellsBuffer(TInput *input, TOutput *output, MeshIOBase::CellGeometryType type)
Represent Red, Green and Blue components for color images.
Definition: itkRGBPixel.h:58
void SetPixelType(const T &, bool UsePointPixel=true)
std::string m_FileName
SizeValueType m_PointDimension
IOComponentType m_CellPixelComponentType
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
SizeValueType Size(void) const
Definition: itkArray.h:124
IOPixelType m_PointPixelType
void SetPixelType(const CovariantVector< T, VLength > &, bool UsePointPixel=true)
ByteOrder m_ByteOrder
void SetPixelType(const std::complex< T > &, bool UsePointPixel=true)
MeshIOBase Self
Definition: itkMeshIOBase.h:73
Abstract superclass defines mesh IO interface.
Definition: itkMeshIOBase.h:69
void WriteBufferAsBinary(TInput *buffer, std::ofstream &outputFile, SizeValueType numberOfComponents)
void ReadBufferAsBinary(T *buffer, std::ifstream &inputFile, SizeValueType numberOfComponents)
void SetByteOrderToBigEndian()
Perform machine dependent byte swapping.
Represent a diffusion tensor as used in DTI images.
A templated class holding a n-Dimensional covariant vector.
FileType m_FileType
void SetPixelType(const VariableLengthVector< T > &vector, bool UsePointPixel=true)
std::vector< std::string > ArrayOfExtensionsType
Definition: itkMeshIOBase.h:79
virtual ~MeshIOBase()
unsigned int m_NumberOfCellPixelComponents