ITK  5.0.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 "ITKIOMeshBaseExport.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 ITKIOMeshBase_EXPORT MeshIOBase:public LightProcessObject
70 {
71 public:
72  ITK_DISALLOW_COPY_AND_ASSIGN(MeshIOBase);
73 
75  using Self = MeshIOBase;
79 
81  using ArrayOfExtensionsType = std::vector< std::string >;
82 
84  using StreamOffsetType = std::streamoff;
85 
87 
93  class UnknownType {};
94 
96  itkTypeMacro(MeshIOBase, LightProcessObject);
97 
99  itkSetStringMacro(FileName);
100  itkGetStringMacro(FileName);
102 
106  typedef enum {UNKNOWNPIXELTYPE, SCALAR, RGB, RGBA, OFFSET, VECTOR,
107  POINT, COVARIANTVECTOR, SYMMETRICSECONDRANKTENSOR,
108  DIFFUSIONTENSOR3D, COMPLEX, FIXEDARRAY, ARRAY, MATRIX,
109  VARIABLELENGTHVECTOR, VARIABLESIZEMATRIX} IOPixelType;
110 
114  typedef enum {UNKNOWNCOMPONENTTYPE, UCHAR, CHAR, USHORT, SHORT, UINT, INT,
115  ULONG, LONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LDOUBLE} IOComponentType;
116 
119  typedef enum {ASCII, BINARY, TYPENOTAPPLICABLE} FileType;
120 
123  typedef enum {BigEndian, LittleEndian, OrderNotApplicable} ByteOrder;
124 
126  typedef enum {VERTEX_CELL = 0, LINE_CELL, TRIANGLE_CELL,
127  QUADRILATERAL_CELL, POLYGON_CELL, TETRAHEDRON_CELL, HEXAHEDRON_CELL,
128  QUADRATIC_EDGE_CELL, QUADRATIC_TRIANGLE_CELL,
129  LAST_ITK_CELL, MAX_ITK_CELLS = 255} CellGeometryType;
130 
136  itkSetEnumMacro(PointPixelType, IOPixelType);
137  itkGetEnumMacro(PointPixelType, IOPixelType);
138  itkSetEnumMacro(CellPixelType, IOPixelType);
139  itkGetEnumMacro(CellPixelType, IOPixelType);
141 
144  itkSetEnumMacro(PointComponentType, IOComponentType);
145  itkGetEnumMacro(PointComponentType, IOComponentType);
146  itkSetEnumMacro(CellComponentType, IOComponentType);
147  itkGetEnumMacro(CellComponentType, IOComponentType);
148  itkSetEnumMacro(PointPixelComponentType, IOComponentType);
149  itkGetEnumMacro(PointPixelComponentType, IOComponentType);
150  itkSetEnumMacro(CellPixelComponentType, IOComponentType);
151  itkGetEnumMacro(CellPixelComponentType, IOComponentType);
153 
154  template< typename T >
156  static constexpr IOComponentType CType = UNKNOWNCOMPONENTTYPE;
157  };
158 
159  template< typename T >
160  void SetPixelType(const T & itkNotUsed(dummy), bool UsePointPixel = true)
161  {
162  if ( UsePointPixel )
163  {
164  SetNumberOfPointPixelComponents(1);
165  SetPointPixelComponentType(MapComponentType< T >::CType);
166  SetPointPixelType(SCALAR);
167  }
168  else
169  {
170  SetNumberOfCellPixelComponents(1);
171  SetCellPixelComponentType(MapComponentType< T >::CType);
172  SetCellPixelType(SCALAR);
173  }
174  }
175 
176  template< typename T >
177  void SetPixelType(const RGBPixel< T > & itkNotUsed(dummy), bool UsePointPixel = true)
178  {
179  if ( UsePointPixel )
180  {
181  SetNumberOfPointPixelComponents(3);
182  SetPointPixelComponentType(MapComponentType< T >::CType);
183  SetPointPixelType(RGB);
184  }
185  else
186  {
187  SetNumberOfCellPixelComponents(3);
188  SetCellPixelComponentType(MapComponentType< T >::CType);
189  SetCellPixelType(RGB);
190  }
191  }
192 
193  template< typename T >
194  void SetPixelType(const RGBAPixel< T > & itkNotUsed(dummy), bool UsePointPixel = true)
195  {
196  if ( UsePointPixel )
197  {
198  SetNumberOfPointPixelComponents(4);
199  SetPointPixelComponentType(MapComponentType< T >::CType);
200  SetPointPixelType(RGBA);
201  }
202  else
203  {
204  SetNumberOfCellPixelComponents(4);
205  SetCellPixelComponentType(MapComponentType< T >::CType);
206  SetCellPixelType(RGBA);
207  }
208  }
209 
210  template< typename T, unsigned int VLength >
211  void SetPixelType(const Vector< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true)
212  {
213  if ( UsePointPixel )
214  {
215  SetNumberOfPointPixelComponents(VLength);
216  SetPointPixelComponentType(MapComponentType< T >::CType);
217  SetPointPixelType(VECTOR);
218  }
219  else
220  {
221  SetNumberOfCellPixelComponents(VLength);
222  SetCellPixelComponentType(MapComponentType< T >::CType);
223  SetCellPixelType(VECTOR);
224  }
225  }
226 
227  template< typename T, unsigned int VLength >
228  void SetPixelType(const CovariantVector< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true)
229  {
230  if ( UsePointPixel )
231  {
232  SetNumberOfPointPixelComponents(VLength);
233  SetPointPixelComponentType(MapComponentType< T >::CType);
234  SetPointPixelType(COVARIANTVECTOR);
235  }
236  else
237  {
238  SetNumberOfCellPixelComponents(VLength);
239  SetCellPixelComponentType(MapComponentType< T >::CType);
240  SetCellPixelType(COVARIANTVECTOR);
241  }
242  }
243 
244  template< typename T, unsigned int VLength >
245  void SetPixelType(const FixedArray< T, VLength > & itkNotUsed(dummy), bool UsePointPixel = true)
246  {
247  if ( UsePointPixel )
248  {
249  SetNumberOfPointPixelComponents(VLength);
250  SetPointPixelComponentType(MapComponentType< T >::CType);
251  SetPointPixelType(FIXEDARRAY);
252  }
253  else
254  {
255  SetNumberOfCellPixelComponents(VLength);
256  SetCellPixelComponentType(MapComponentType< T >::CType);
257  SetCellPixelType(FIXEDARRAY);
258  }
259  }
260 
261  template< typename T, unsigned int VLength >
262  void SetPixelType(const SymmetricSecondRankTensor< T, VLength > itkNotUsed(dummy), bool UsePointPixel = true)
263  {
264  if ( UsePointPixel )
265  {
266  SetNumberOfPointPixelComponents(VLength * ( VLength + 1 ) / 2);
267  SetPointPixelComponentType(MapComponentType< T >::CType);
268  SetPointPixelType(SYMMETRICSECONDRANKTENSOR);
269  }
270  else
271  {
272  SetNumberOfCellPixelComponents(VLength * ( VLength + 1 ) / 2);
273  SetCellPixelComponentType(MapComponentType< T >::CType);
274  SetCellPixelType(SYMMETRICSECONDRANKTENSOR);
275  }
276  }
277 
278  template< typename T >
279  void SetPixelType(const DiffusionTensor3D< T > & itkNotUsed(dummy), bool UsePointPixel = true)
280  {
281  if ( UsePointPixel )
282  {
283  SetNumberOfPointPixelComponents(6);
284  SetPointPixelComponentType(MapComponentType< T >::CType);
285  SetPointPixelType(DIFFUSIONTENSOR3D);
286  }
287  else
288  {
289  SetNumberOfCellPixelComponents(6);
290  SetCellPixelComponentType(MapComponentType< T >::CType);
291  SetCellPixelType(DIFFUSIONTENSOR3D);
292  }
293  }
294 
295  template< typename T, unsigned int NR, unsigned int NC >
296  void SetPixelType(const Matrix< T, NR, NC > & itkNotUsed(dummy), bool UsePointPixel = true)
297  {
298  if ( UsePointPixel )
299  {
300  SetNumberOfPointPixelComponents(NR * NC);
301  SetPointPixelComponentType(MapComponentType< T >::CType);
302  SetPointPixelType(MATRIX);
303  }
304  else
305  {
306  SetNumberOfCellPixelComponents(NR * NC);
307  SetCellPixelComponentType(MapComponentType< T >::CType);
308  SetCellPixelType(MATRIX);
309  }
310  }
311 
312  template< typename T >
313  void SetPixelType(const std::complex< T > & itkNotUsed(dummy), bool UsePointPixel = true)
314  {
315  if ( UsePointPixel )
316  {
317  SetNumberOfPointPixelComponents(2);
318  SetPointPixelComponentType(MapComponentType< T >::CType);
319  SetPointPixelType(COMPLEX);
320  }
321  else
322  {
323  SetNumberOfCellPixelComponents(2);
324  SetCellPixelComponentType(MapComponentType< T >::CType);
325  SetCellPixelType(COMPLEX);
326  }
327  }
328 
329  template< typename T >
330  void SetPixelType(const Array< T > & array, bool UsePointPixel = true)
331  {
332  if ( UsePointPixel )
333  {
334  SetNumberOfPointPixelComponents( array.Size() );
335  SetPointPixelComponentType(MapComponentType< T >::CType);
336  SetPointPixelType(ARRAY);
337  }
338  else
339  {
340  SetNumberOfCellPixelComponents( array.Size() );
341  SetCellPixelComponentType(MapComponentType< T >::CType);
342  SetCellPixelType(ARRAY);
343  }
344  }
345 
346  template< typename T >
347  void SetPixelType(const VariableLengthVector< T > & vector, bool UsePointPixel = true)
348  {
349  if ( UsePointPixel )
350  {
351  SetNumberOfPointPixelComponents( vector.Size() );
352  SetPointPixelComponentType(MapComponentType< T >::CType);
353  SetPointPixelType(VARIABLELENGTHVECTOR);
354  }
355  else
356  {
357  SetNumberOfCellPixelComponents( vector.Size() );
358  SetCellPixelComponentType(MapComponentType< T >::CType);
359  SetCellPixelType(VARIABLELENGTHVECTOR);
360  }
361  }
362 
363  template< typename T >
364  void SetPixelType(const VariableSizeMatrix< T > & matrix, bool UsePointPixel = true)
365  {
366  if ( UsePointPixel )
367  {
368  SetNumberOfPointPixelComponents( matrix.Rows() * matrix.Cols() );
369  SetPointPixelComponentType(MapComponentType< T >::CType);
370  SetPointPixelType(VARIABLESIZEMATRIX);
371  }
372  else
373  {
374  SetNumberOfCellPixelComponents( matrix.Rows() * matrix.Cols() );
375  SetCellPixelComponentType(MapComponentType< T >::CType);
376  SetCellPixelType(VARIABLESIZEMATRIX);
377  }
378  }
379 
384  itkSetMacro(NumberOfPointPixelComponents, unsigned int);
385  itkGetConstMacro(NumberOfPointPixelComponents, unsigned int);
386  itkSetMacro(NumberOfCellPixelComponents, unsigned int);
387  itkGetConstMacro(NumberOfCellPixelComponents, unsigned int);
388  itkSetMacro(PointDimension, unsigned int);
389  itkGetConstMacro(PointDimension, unsigned int);
390  itkSetMacro(NumberOfPoints, SizeValueType);
391  itkGetConstMacro(NumberOfPoints, SizeValueType);
392  itkSetMacro(NumberOfCells, SizeValueType);
393  itkGetConstMacro(NumberOfCells, SizeValueType);
394  itkSetMacro(NumberOfPointPixels, SizeValueType);
395  itkGetConstMacro(NumberOfPointPixels, SizeValueType);
396  itkSetMacro(NumberOfCellPixels, SizeValueType);
397  itkGetConstMacro(NumberOfCellPixels, SizeValueType);
398  itkSetMacro(CellBufferSize, SizeValueType);
399  itkGetConstMacro(CellBufferSize, SizeValueType);
400  itkSetMacro(UpdatePoints, bool);
401  itkGetConstMacro(UpdatePoints, bool);
402  itkSetMacro(UpdateCells, bool);
403  itkGetConstMacro(UpdateCells, bool);
404  itkSetMacro(UpdatePointData, bool);
405  itkGetConstMacro(UpdatePointData, bool);
406  itkSetMacro(UpdateCellData, bool);
407  itkGetConstMacro(UpdateCellData, bool);
409 
410  unsigned int GetComponentSize(IOComponentType componentType) const;
411 
414  std::string GetComponentTypeAsString(IOComponentType) const;
415 
418  std::string GetPixelTypeAsString(IOPixelType) const;
419 
422  itkSetEnumMacro(FileType, FileType);
423  itkGetEnumMacro(FileType, FileType);
425 
427  {
428  this->SetFileType(ASCII);
429  }
430 
432  {
433  this->SetFileType(BINARY);
434  }
435 
447  itkSetEnumMacro(ByteOrder, ByteOrder);
448  itkGetEnumMacro(ByteOrder, ByteOrder);
450 
452  {
453  this->SetByteOrder(BigEndian);
454  }
455 
457  {
458  this->SetByteOrder(LittleEndian);
459  }
460 
462  itkSetMacro(UseCompression, bool);
463  itkGetConstMacro(UseCompression, bool);
464  itkBooleanMacro(UseCompression);
466 
469  std::string GetFileTypeAsString(FileType) const;
470 
473  std::string GetByteOrderAsString(ByteOrder) const;
474 
475  /*-------- This part of the interfaces deals with reading data ----- */
478  virtual bool CanReadFile(const char *) = 0;
479 
482  virtual void ReadMeshInformation() = 0;
483 
485  virtual void ReadPoints(void *buffer) = 0;
486 
487  virtual void ReadCells(void *buffer) = 0;
488 
489  virtual void ReadPointData(void *buffer) = 0;
490 
491  virtual void ReadCellData(void *buffer) = 0;
492 
493  /*-------- This part of the interfaces deals with writing data ----- */
494 
497  virtual bool CanWriteFile(const char *) = 0;
498 
499  virtual void WriteMeshInformation() = 0;
500 
501  virtual void WritePoints(void *buffer) = 0;
502 
503  virtual void WriteCells(void *buffer) = 0;
504 
505  virtual void WritePointData(void *buffer) = 0;
506 
507  virtual void WriteCellData(void *buffer) = 0;
508 
509  virtual void Write() = 0;
510 
515  const ArrayOfExtensionsType & GetSupportedReadExtensions() const;
516 
521  const ArrayOfExtensionsType & GetSupportedWriteExtensions() const;
522 
523 protected:
524  MeshIOBase();
525  ~MeshIOBase() override = default;
526 
527  void PrintSelf(std::ostream & os, Indent indent) const override;
528 
530  void AddSupportedReadExtension(const char *extension);
531 
533  void AddSupportedWriteExtension(const char *extension);
534 
536  template< typename T >
537  void ReadBufferAsAscii(T *buffer, std::ifstream & inputFile, SizeValueType numberOfComponents)
538  {
539  for ( SizeValueType i = 0; i < numberOfComponents; i++ )
540  {
541  inputFile >> buffer[i];
542  }
543  }
545 
547  template< typename T >
548  void ReadBufferAsBinary(T *buffer, std::ifstream & inputFile, SizeValueType numberOfComponents)
549  {
550  inputFile.read( reinterpret_cast< char * >( buffer ), numberOfComponents * sizeof( T ) );
551 
552  if ( m_ByteOrder == BigEndian )
553  {
555  {
556  itk::ByteSwapper< T >::SwapRangeFromSystemToBigEndian(buffer, numberOfComponents);
557  }
558  }
559  else if ( m_ByteOrder == LittleEndian )
560  {
562  {
564  }
565  }
566  }
567 
569  template< typename T >
570  void WriteBufferAsAscii(T *buffer, std::ofstream & outputFile, SizeValueType numberOfLines, SizeValueType numberOfComponents)
571  {
572  NumberToString<T> convert;
573  for ( SizeValueType ii = 0; ii < numberOfLines; ii++ )
574  {
575  for ( SizeValueType jj = 0; jj < numberOfComponents; jj++ )
576  {
577  outputFile << convert(buffer[ii * numberOfComponents + jj]) << " ";
578  }
579  outputFile << '\n';
580  }
581  }
583 
585  template< typename TOutput, typename TInput >
586  void WriteBufferAsBinary(TInput *buffer, std::ofstream & outputFile, SizeValueType numberOfComponents)
587  {
588  if ( typeid( TInput ) == typeid( TOutput ) )
589  {
590  if ( m_ByteOrder == BigEndian && itk::ByteSwapper< TInput >::SystemIsLittleEndian() )
591  {
593  }
594  else if ( m_ByteOrder == LittleEndian && itk::ByteSwapper< TInput >::SystemIsBigEndian() )
595  {
597  }
599 
600  outputFile.write(reinterpret_cast< char * >( buffer ), numberOfComponents);
601  }
602  else
603  {
604  auto * data = new TOutput[numberOfComponents];
605  for ( SizeValueType ii = 0; ii < numberOfComponents; ii++ )
606  {
607  data[ii] = static_cast< TOutput >( buffer[ii] );
608  }
609 
610  if ( m_ByteOrder == BigEndian && itk::ByteSwapper< TOutput >::SystemIsLittleEndian() )
611  {
613  }
614  else if ( m_ByteOrder == LittleEndian && itk::ByteSwapper< TOutput >::SystemIsBigEndian() )
615  {
617  }
618 
619  outputFile.write(reinterpret_cast< char * >( data ), numberOfComponents);
620  delete[] data;
621  }
622  }
623 
627  template< typename TInput, typename TOutput >
628  void ReadCellsBuffer(TInput *input, TOutput *output)
629  {
630  if ( input && output )
631  {
634  for ( SizeValueType ii = 0; ii < m_NumberOfCells; ii++ )
635  {
636  inputIndex++; // ignore the cell type
637  auto numberOfPoints = static_cast< unsigned int >( input[inputIndex++] );
638  for ( unsigned int jj = 0; jj < numberOfPoints; jj++ )
639  {
640  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
641  }
642  }
643  }
644  }
646 
650  template< typename TInput, typename TOutput >
651  void ReadCellsBuffer(TInput *input, TOutput *output, MeshIOBase::CellGeometryType type)
652  {
653  if ( input && output )
654  {
655  SizeValueType inputIndex = itk::NumericTraits< SizeValueType >::ZeroValue();
656  SizeValueType outputIndex = itk::NumericTraits< SizeValueType >::ZeroValue();
658 
659  for ( SizeValueType ii = 0; ii < m_NumberOfCells; ii++ )
660  {
661  auto cellType = static_cast< MeshIOBase::CellGeometryType >( input[inputIndex++] );
662  auto nn = static_cast< unsigned int >( input[inputIndex++] );
663  if ( cellType == type )
664  {
665  output[outputIndex++] = nn;
666  for ( unsigned int jj = 0; jj < nn; jj++ )
667  {
668  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
669  }
670  }
671  else
672  {
673  inputIndex += nn;
674  }
675  }
676  }
677  }
678 
681  template< typename TInput, typename TOutput >
682  void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, unsigned int numberOfPoints, SizeValueType numberOfCells)
683  {
684  if ( input && output )
685  {
688  for ( SizeValueType ii = 0; ii < numberOfCells; ii++ )
689  {
690  output[outputIndex++] = static_cast< TOutput >( cellType );
691  output[outputIndex++] = static_cast< TOutput >( numberOfPoints );
692  for ( unsigned int jj = 0; jj < numberOfPoints; jj++ )
693  {
694  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
695  }
696  }
697  }
698  }
700 
703  template< typename TInput, typename TOutput >
704  void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, SizeValueType numberOfCells)
705  {
706  if ( input && output )
707  {
710  for ( SizeValueType ii = 0; ii < numberOfCells; ii++ )
711  {
712  auto numberOfPoints = static_cast< unsigned int >( input[inputIndex++] );
713  output[outputIndex++] = static_cast< TOutput >( cellType );
714  output[outputIndex++] = static_cast< TOutput >( numberOfPoints );
715  for ( unsigned int jj = 0; jj < numberOfPoints; jj++ )
716  {
717  output[outputIndex++] = static_cast< TOutput >( input[inputIndex++] );
718  }
719  }
720  }
721  }
723 
724 protected:
726  ByteOrder m_ByteOrder{OrderNotApplicable};
727  FileType m_FileType{ASCII};
728 
730  std::string m_FileName;
731 
733  bool m_UseCompression{false};
734 
736  IOComponentType m_PointComponentType{UNKNOWNCOMPONENTTYPE};
737  IOComponentType m_CellComponentType{UNKNOWNCOMPONENTTYPE};
738  IOComponentType m_PointPixelComponentType{UNKNOWNCOMPONENTTYPE};
739  IOComponentType m_CellPixelComponentType{UNKNOWNCOMPONENTTYPE};
740 
742  IOPixelType m_PointPixelType{SCALAR};
743  IOPixelType m_CellPixelType{SCALAR};
744 
747  unsigned int m_NumberOfPointPixelComponents{0};
748  unsigned int m_NumberOfCellPixelComponents{0};
749 
751  SizeValueType m_PointDimension{3};
752 
758 
761 
764  bool m_UpdatePoints{false};
765  bool m_UpdateCells{false};
766  bool m_UpdatePointData{false};
767  bool m_UpdateCellData{false};
768 
769 private:
772 };
773 #define MESHIOBASE_TYPEMAP(type, ctype) \
774  template< > \
775  struct MeshIOBase:: MapComponentType< type > \
776  { \
777  static constexpr IOComponentType CType = ctype; \
778  }
779 
780 MESHIOBASE_TYPEMAP(unsigned char, UCHAR);
781 MESHIOBASE_TYPEMAP(char, CHAR);
782 MESHIOBASE_TYPEMAP(unsigned short, USHORT);
783 MESHIOBASE_TYPEMAP(short, SHORT);
784 MESHIOBASE_TYPEMAP(unsigned int, UINT);
785 MESHIOBASE_TYPEMAP(int, INT);
786 MESHIOBASE_TYPEMAP(unsigned long, ULONG);
787 MESHIOBASE_TYPEMAP(long, LONG);
788 MESHIOBASE_TYPEMAP(unsigned long long, ULONGLONG);
789 MESHIOBASE_TYPEMAP(long long, LONGLONG);
790 MESHIOBASE_TYPEMAP(float, FLOAT);
791 MESHIOBASE_TYPEMAP(double, DOUBLE);
792 MESHIOBASE_TYPEMAP(long double, LDOUBLE);
793 #undef MESHIOBASE_TYPEMAP
794 } // end namespace itk
795 
796 #endif
Array class with size defined at construction time.
Definition: itkArray.h:46
void SetByteOrderToLittleEndian()
SizeValueType m_NumberOfCells
ArrayOfExtensionsType m_SupportedReadExtensions
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:49
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)
IdentifierType SizeValueType
Definition: itkMeshIOBase.h:86
Define numeric traits for std::vector.
Represent Red, Green, Blue and Alpha components for color images.
Definition: itkRGBAPixel.h:59
Represent a symmetric tensor of second rank.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
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)
void SetPixelType(const DiffusionTensor3D< T > &, bool UsePointPixel=true)
void WriteBufferAsAscii(T *buffer, std::ofstream &outputFile, SizeValueType numberOfLines, SizeValueType numberOfComponents)
unsigned int Cols() const
std::vector< std::string > ArrayOfExtensionsType
Definition: itkMeshIOBase.h:81
void SetFileTypeToASCII()
void SetPixelType(const Matrix< T, NR, NC > &, bool UsePointPixel=true)
SizeValueType m_NumberOfCellPixels
void SetPixelType(const RGBPixel< T > &, bool UsePointPixel=true)
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:51
void SetPixelType(const Vector< T, VLength > &, bool UsePointPixel=true)
static void SwapRangeFromSystemToBigEndian(T *p, BufferSizeType num)
std::streamoff StreamOffsetType
Definition: itkMeshIOBase.h:84
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
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
void SetPixelType(const VariableSizeMatrix< T > &matrix, bool UsePointPixel=true)
SizeValueType Size() const
Definition: itkArray.h:120
ArrayOfExtensionsType m_SupportedWriteExtensions
void WriteCellsBuffer(TInput *input, TOutput *output, CellGeometryType cellType, SizeValueType numberOfCells)
void SetFileTypeToBinary()
static void SwapRangeFromSystemToLittleEndian(T *p, BufferSizeType num)
SizeValueType m_NumberOfPointPixels
MESHIOBASE_TYPEMAP(unsigned char, UCHAR)
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
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void SetPixelType(const CovariantVector< T, VLength > &, bool UsePointPixel=true)
void SetPixelType(const std::complex< T > &, bool UsePointPixel=true)
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()
Base class for most ITK classes.
Definition: itkObject.h:60
Perform machine dependent byte swapping.
Represent a diffusion tensor as used in DTI images.
A templated class holding a n-Dimensional covariant vector.
void SetPixelType(const VariableLengthVector< T > &vector, bool UsePointPixel=true)