ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkImageIOBase.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkImageIOBase_h
19#define itkImageIOBase_h
20#include "ITKIOImageBaseExport.h"
21
22#include "itkIOConfigure.h"
23
25#include "itkIndent.h"
26#include "itkImageIORegion.h"
27#include "itkRGBPixel.h"
28#include "itkRGBAPixel.h"
29#include "itkCovariantVector.h"
32#include "itkArray.h"
35#include "itkCommonEnums.h"
36
37#include "vnl/vnl_vector.h"
38#include "vcl_compiler.h"
39
40#include <fstream>
41#include <string>
42#include <type_traits> // For is_same_v and is_signed_v.
43
44namespace itk
45{
46// Forward reference for VariableLengthVector
47template <typename TValue>
49
78class ITKIOImageBase_EXPORT ImageIOBase : public LightProcessObject
79{
80public:
81 ITK_DISALLOW_COPY_AND_MOVE(ImageIOBase);
82
88
90 itkOverrideGetNameOfClassMacro(ImageIOBase);
91
94 itkSetStringMacro(FileName);
95 itkGetStringMacro(FileName);
97
101
102#ifndef ITK_LEGACY_REMOVE
108 class [[deprecated("This class is intended to be removed from ITK 6.")]] UnknownType
109 {};
110#endif
111
112#if !defined(ITK_LEGACY_REMOVE)
114 using IOPixelType = IOPixelEnum;
115 static constexpr IOPixelEnum UNKNOWNPIXELTYPE = IOPixelEnum::UNKNOWNPIXELTYPE;
116 static constexpr IOPixelEnum SCALAR = IOPixelEnum::SCALAR;
117 static constexpr IOPixelEnum RGB = IOPixelEnum::RGB;
118 static constexpr IOPixelEnum RGBA = IOPixelEnum::RGBA;
119 static constexpr IOPixelEnum OFFSET = IOPixelEnum::OFFSET;
120 static constexpr IOPixelEnum VECTOR = IOPixelEnum::VECTOR;
121 static constexpr IOPixelEnum POINT = IOPixelEnum::POINT;
122 static constexpr IOPixelEnum COVARIANTVECTOR = IOPixelEnum::COVARIANTVECTOR;
123 static constexpr IOPixelEnum SYMMETRICSECONDRANKTENSOR = IOPixelEnum::SYMMETRICSECONDRANKTENSOR;
124 static constexpr IOPixelEnum DIFFUSIONTENSOR3D = IOPixelEnum::DIFFUSIONTENSOR3D;
125 static constexpr IOPixelEnum COMPLEX = IOPixelEnum::COMPLEX;
126 static constexpr IOPixelEnum FIXEDARRAY = IOPixelEnum::FIXEDARRAY;
127 static constexpr IOPixelEnum MATRIX = IOPixelEnum::MATRIX;
128#endif
129
131#if !defined(ITK_LEGACY_REMOVE)
133 using IOComponentType = IOComponentEnum;
134 static constexpr IOComponentEnum UNKNOWNCOMPONENTTYPE = IOComponentEnum::UNKNOWNCOMPONENTTYPE;
135 static constexpr IOComponentEnum UCHAR = IOComponentEnum::UCHAR;
136 static constexpr IOComponentEnum CHAR = IOComponentEnum::CHAR;
137 static constexpr IOComponentEnum USHORT = IOComponentEnum::USHORT;
138 static constexpr IOComponentEnum SHORT = IOComponentEnum::SHORT;
139 static constexpr IOComponentEnum UINT = IOComponentEnum::UINT;
140 static constexpr IOComponentEnum INT = IOComponentEnum::INT;
141 static constexpr IOComponentEnum ULONG = IOComponentEnum::ULONG;
142 static constexpr IOComponentEnum LONG = IOComponentEnum::LONG;
143 static constexpr IOComponentEnum ULONGLONG = IOComponentEnum::ULONGLONG;
144 static constexpr IOComponentEnum LONGLONG = IOComponentEnum::LONGLONG;
145 static constexpr IOComponentEnum FLOAT = IOComponentEnum::FLOAT;
146 static constexpr IOComponentEnum DOUBLE = IOComponentEnum::DOUBLE;
147#endif
148
150#if !defined(ITK_LEGACY_REMOVE)
152 static constexpr IOFileEnum ASCII = IOFileEnum::ASCII;
153 static constexpr IOFileEnum Binary = IOFileEnum::Binary;
154 static constexpr IOFileEnum TypeNotApplicable = IOFileEnum::TypeNotApplicable;
155#endif
156
158#if !defined(ITK_LEGACY_REMOVE)
159 using ByteOrder = itk::IOByteOrderEnum;
161 static constexpr IOByteOrderEnum BigEndian = IOByteOrderEnum::BigEndian;
162 static constexpr IOByteOrderEnum LittleEndian = IOByteOrderEnum::LittleEndian;
163 static constexpr IOByteOrderEnum OrderNotApplicable = IOByteOrderEnum::OrderNotApplicable;
164#endif
165
169 void
171
172 itkGetConstMacro(NumberOfDimensions, unsigned int);
173
178 virtual void
179 SetDimensions(unsigned int i, SizeValueType dim);
180 virtual SizeValueType
181
182 GetDimensions(unsigned int i) const
183 {
184 return m_Dimensions[i];
185 }
186
187
190 virtual void
191 SetOrigin(unsigned int i, double origin);
192
193 virtual double
194 GetOrigin(unsigned int i) const
195 {
196 return m_Origin[i];
197 }
198
201 virtual void
202 SetSpacing(unsigned int i, double spacing);
203
204 virtual double
205 GetSpacing(unsigned int i) const
206 {
207 return m_Spacing[i];
208 }
209
212 virtual void
213 SetDirection(unsigned int i, const std::vector<double> & direction);
214
215 virtual void
216 SetDirection(unsigned int i, const vnl_vector<double> & direction);
217
218 virtual std::vector<double>
219 GetDirection(unsigned int i) const
220 {
221 return m_Direction[i];
222 }
223
226 virtual std::vector<double>
227 GetDefaultDirection(unsigned int k) const;
228
236 itkSetMacro(IORegion, ImageIORegion);
237 itkGetConstReferenceMacro(IORegion, ImageIORegion);
239
246 itkSetEnumMacro(PixelType, itk::CommonEnums::IOPixel);
247 itkGetEnumMacro(PixelType, itk::CommonEnums::IOPixel);
249
252 itkSetEnumMacro(ComponentType, IOComponentEnum);
253 itkGetEnumMacro(ComponentType, IOComponentEnum);
254
255#ifndef ITK_LEGACY_REMOVE
263 itkLegacyMacro(virtual const std::type_info & GetComponentTypeInfo() const);
264#endif
265
271 itkSetMacro(NumberOfComponents, unsigned int);
272 itkGetConstReferenceMacro(NumberOfComponents, unsigned int);
274
277 itkSetMacro(UseCompression, bool);
278 itkGetConstMacro(UseCompression, bool);
279 itkBooleanMacro(UseCompression);
281
288 itkSetClampMacro(CompressionLevel, int, 1, this->GetMaximumCompressionLevel());
289 itkGetConstMacro(CompressionLevel, int);
290
301 virtual void
302 SetCompressor(std::string _c);
303 itkGetConstReferenceMacro(Compressor, std::string);
304
307 itkSetMacro(UseStreamedReading, bool);
308 itkGetConstMacro(UseStreamedReading, bool);
309 itkBooleanMacro(UseStreamedReading);
311
314 itkSetMacro(UseStreamedWriting, bool);
315 itkGetConstMacro(UseStreamedWriting, bool);
316 itkBooleanMacro(UseStreamedWriting);
318
324 itkSetMacro(ExpandRGBPalette, bool);
325 itkGetConstMacro(ExpandRGBPalette, bool);
326 itkBooleanMacro(ExpandRGBPalette);
328
332 itkSetMacro(WritePalette, bool);
333 itkGetConstMacro(WritePalette, bool);
334 itkBooleanMacro(WritePalette);
336
341 itkGetConstMacro(IsReadAsScalarPlusPalette, bool);
342
346
348 static constexpr bool
350 {
351 return GetComponentTypeTraits(componentEnum).isFloatingPoint;
352 }
353
355 static constexpr bool
357 {
358 return GetComponentTypeTraits(componentEnum).isUnsigned;
359 }
360
362 static constexpr size_t
364 {
365 return GetComponentTypeTraits(componentEnum).sizeOfComponent * size_t{ CHAR_BIT };
366 }
367
370 static constexpr IOComponentEnum
371 GetComponentTypeFromTypeTraits(const bool isFloatingPoint, const bool isUnsigned, const size_t numberOfBits)
372 {
373 for (const auto componentEnum : { IOComponentEnum::UINT8,
374 IOComponentEnum::INT8,
375 IOComponentEnum::UINT16,
376 IOComponentEnum::INT16,
377 IOComponentEnum::UINT32,
378 IOComponentEnum::INT32,
379 IOComponentEnum::UINT64,
380 IOComponentEnum::INT64,
381 IOComponentEnum::FLOAT32,
382 IOComponentEnum::FLOAT64 })
383 {
384 if (const ComponentTypeTraits typeTraits = GetComponentTypeTraits(componentEnum);
385 typeTraits.isFloatingPoint == isFloatingPoint && typeTraits.isUnsigned == isUnsigned &&
386 typeTraits.sizeOfComponent * size_t{ CHAR_BIT } == numberOfBits)
387 {
388 return componentEnum;
389 }
390 }
391 return IOComponentEnum::UNKNOWNCOMPONENTTYPE;
392 }
393
395 static IOComponentEnum
396 GetComponentTypeFromString(const std::string & typeString);
397
401
403 static IOPixelEnum
404 GetPixelTypeFromString(const std::string & pixelString);
405
409 itkSetEnumMacro(FileType, IOFileEnum);
410 itkGetEnumMacro(FileType, IOFileEnum);
411 void
413 {
414 this->SetFileType(IOFileEnum::ASCII);
415 }
416
417
418 void
420 {
421 this->SetFileType(IOFileEnum::Binary);
422 }
423
436 itkSetEnumMacro(ByteOrder, IOByteOrderEnum);
437 itkGetEnumMacro(ByteOrder, IOByteOrderEnum);
438 void
440 {
441 this->SetByteOrder(IOByteOrderEnum::BigEndian);
442 }
443
444
445 void
447 {
448 this->SetByteOrder(IOByteOrderEnum::LittleEndian);
449 }
450
453 std::string GetFileTypeAsString(IOFileEnum) const;
454
458
460 using SizeType = itk::intmax_t;
461
465
472 virtual SizeType
474
478
482
487
492 virtual unsigned int
494
495 /*-------- This part of the interfaces deals with reading data ----- */
496
499 virtual bool
500 CanReadFile(const char *) = 0;
501
506 virtual bool
508 {
509 return false;
510 }
511
514 virtual void
516
518 virtual void
519 Read(void * buffer) = 0;
520
521 /*-------- This part of the interfaces deals with writing data ----- */
522
525 virtual bool
526 CanWriteFile(const char *) = 0;
527
534 virtual bool
536 {
537 return false;
538 }
539
542 virtual void
544
548 virtual void
549 Write(const void * buffer) = 0;
550
551 /* --- Support reading and writing data as a series of files. --- */
552
558 virtual bool
559 SupportsDimension(unsigned long dim)
560 {
561 return (dim == 2);
562 }
563
575 virtual ImageIORegion
577
592 virtual unsigned int
593 GetActualNumberOfSplitsForWriting(unsigned int numberOfRequestedSplits,
594 const ImageIORegion & pasteRegion,
595 const ImageIORegion & largestPossibleRegion);
596
603 virtual ImageIORegion
604 GetSplitRegionForWriting(unsigned int ithPiece,
605 unsigned int numberOfActualSplits,
606 const ImageIORegion & pasteRegion,
607 const ImageIORegion & largestPossibleRegion);
608
610 using ArrayOfExtensionsType = std::vector<std::string>;
611
618
625
626#ifndef ITK_LEGACY_REMOVE
627 // This member function (template) is not implemented and not specialized.
628 template <typename TPixel>
629 itkLegacyMacro(void SetTypeInfo(const TPixel *));
630#endif
631
634 template <typename TComponent>
636 {
637 static constexpr IOComponentEnum CType =
638 std::is_same_v<TComponent, char> ? (std::is_signed_v<char> ? IOComponentEnum::CHAR : IOComponentEnum::UCHAR)
639 : std::is_same_v<TComponent, signed char> ? IOComponentEnum::CHAR
640 : std::is_same_v<TComponent, unsigned char> ? IOComponentEnum::UCHAR
641 : std::is_same_v<TComponent, short> ? IOComponentEnum::SHORT
642 : std::is_same_v<TComponent, unsigned short> ? IOComponentEnum::USHORT
643 : std::is_same_v<TComponent, int> ? IOComponentEnum::INT
644 : std::is_same_v<TComponent, unsigned int> ? IOComponentEnum::UINT
645 : std::is_same_v<TComponent, long> ? IOComponentEnum::LONG
646 : std::is_same_v<TComponent, unsigned long> ? IOComponentEnum::ULONG
647 : std::is_same_v<TComponent, long long> ? IOComponentEnum::LONGLONG
648 : std::is_same_v<TComponent, unsigned long long> ? IOComponentEnum::ULONGLONG
649 : std::is_same_v<TComponent, float> ? IOComponentEnum::FLOAT
650 : std::is_same_v<TComponent, double> ? IOComponentEnum::DOUBLE
651 : IOComponentEnum::UNKNOWNCOMPONENTTYPE;
652 };
653
654 template <typename TPixel>
655 void
656 SetPixelTypeInfo(const TPixel *)
657 {
658 this->SetNumberOfComponents(1);
659 this->SetPixelType(IOPixelEnum::SCALAR);
661 }
662 template <typename TComponent>
663 void
665 {
666 this->SetNumberOfComponents(3);
667 this->SetPixelType(IOPixelEnum::RGB);
669 }
670 template <typename TComponent>
671 void
673 {
674 this->SetNumberOfComponents(4);
675 this->SetPixelType(IOPixelEnum::RGBA);
677 }
678 template <unsigned int VLength>
679 void
681 {
682 this->SetNumberOfComponents(VLength);
683 this->SetPixelType(IOPixelEnum::OFFSET);
684 this->SetComponentType(IOComponentEnum::LONG);
685 }
686 template <typename TComponent, unsigned int VLength>
687 void
689 {
690 this->SetNumberOfComponents(VLength);
691 this->SetPixelType(IOPixelEnum::VECTOR);
693 }
694 template <typename TCoordinate, unsigned int VPointDimension>
695 void
697 {
698 this->SetNumberOfComponents(VPointDimension);
699 this->SetPixelType(IOPixelEnum::POINT);
701 }
702 template <typename TComponent, unsigned int VLength>
703 void
705 {
706 this->SetNumberOfComponents(VLength);
707 this->SetPixelType(IOPixelEnum::COVARIANTVECTOR);
709 }
710 template <typename TComponent, unsigned int VLength>
711 void
713 {
714 this->SetNumberOfComponents(VLength * (VLength + 1) / 2);
715 this->SetPixelType(IOPixelEnum::SYMMETRICSECONDRANKTENSOR);
717 }
718 template <typename TComponent>
719 void
721 {
722 this->SetNumberOfComponents(6);
723 this->SetPixelType(IOPixelEnum::DIFFUSIONTENSOR3D);
725 }
726 template <typename TComponent>
727 void
728 SetPixelTypeInfo(const std::complex<TComponent> *)
729 {
730 this->SetNumberOfComponents(2);
731 this->SetPixelType(IOPixelEnum::COMPLEX);
733 }
734 template <typename TComponent, unsigned int VLength>
735 void
737 {
738 this->SetNumberOfComponents(VLength);
739 this->SetPixelType(IOPixelEnum::FIXEDARRAY);
741 }
742 template <typename TComponent>
743 void
745 {
746 this->SetNumberOfComponents(1);
747 this->SetPixelType(IOPixelEnum::VARIABLELENGTHVECTOR);
749 }
750 template <typename TValue>
751 void
753 {
754 this->SetNumberOfComponents(1);
755 this->SetPixelType(IOPixelEnum::ARRAY);
757 }
758 template <typename TComponent, unsigned int VLength>
759 void
761 {
762 this->SetNumberOfComponents(VLength * VLength);
763 this->SetPixelType(IOPixelEnum::MATRIX);
765 }
766 template <typename TValue>
767 void
769 {
770 this->SetNumberOfComponents(1);
771 this->SetPixelType(IOPixelEnum::VARIABLESIZEMATRIX);
773 }
774
775
776protected:
778 ~ImageIOBase() override;
779 void
780 PrintSelf(std::ostream & os, Indent indent) const override;
781
782 virtual const ImageRegionSplitterBase *
784
790 virtual bool
791 HasSupportedReadExtension(const char * fileName, bool ignoreCase = true);
792 virtual bool
793 HasSupportedWriteExtension(const char * fileName, bool ignoreCase = true);
795
797 IOPixelEnum m_PixelType{ IOPixelEnum::SCALAR };
798
801 IOComponentEnum m_ComponentType{ IOComponentEnum::UNKNOWNCOMPONENTTYPE };
802
804 IOByteOrderEnum m_ByteOrder{ IOByteOrderEnum::OrderNotApplicable };
805
806 IOFileEnum m_FileType{ IOFileEnum::TypeNotApplicable };
807
810
812 std::string m_FileName{};
813
816 unsigned int m_NumberOfComponents{};
817
819 unsigned int m_NumberOfDimensions{ 0 };
820
822 bool m_UseCompression{ false };
823
824
827 std::string m_Compressor{ "uninitialized" };
828
831 virtual void
833 itkGetConstMacro(MaximumCompressionLevel, int);
835
839 virtual void
840 InternalSetCompressor(const std::string & _compressor);
841
844
847
850
854
857
861
863 std::vector<SizeValueType> m_Dimensions{};
864
867 std::vector<double> m_Spacing{};
868
870 std::vector<double> m_Origin{};
871
873 std::vector<std::vector<double>> m_Direction{};
874
877 std::vector<SizeType> m_Strides{};
878
880 virtual void
881 Reset(const bool freeDynamic = true);
882
884 void
885 Resize(const unsigned int numDimensions, const unsigned int * dimensions);
886
889 virtual unsigned int
891
898 void
900
905
910
915
927 virtual void
928 OpenFileForReading(std::ifstream & inputStream, const std::string & filename, bool ascii = false);
929
945 virtual void
946 OpenFileForWriting(std::ofstream & outputStream,
947 const std::string & filename,
948 bool truncate = true,
949 bool ascii = false);
950
952 virtual void
953 WriteBufferAsASCII(std::ostream & os, const void * buffer, IOComponentEnum ctype, SizeType numComp);
954
956 virtual void
957 ReadBufferAsASCII(std::istream & is, void * buffer, IOComponentEnum ctype, SizeType numComp);
958
960 bool
961 ReadBufferAsBinary(std::istream & is, void * buffer, SizeType num);
962
964 void
965 AddSupportedReadExtension(const char * extension);
966
968 void
969 AddSupportedWriteExtension(const char * extension);
970
971
972 void
974 void
976
979 virtual unsigned int
980 GetActualNumberOfSplitsForWritingCanStreamWrite(unsigned int numberOfRequestedSplits,
981 const ImageIORegion & pasteRegion) const;
982
985 virtual ImageIORegion
987 unsigned int numberOfActualSplits,
988 const ImageIORegion & pasteRegion) const;
989
990private:
992 {
995 unsigned int sizeOfComponent;
996
997 template <typename... TComponent>
998 static constexpr ComponentTypeTraits
999 Get(const IOComponentEnum componentEnum)
1000 {
1001 ComponentTypeTraits result{};
1002 return ((MapPixelType<TComponent>::CType == componentEnum
1003 ? result = { std::is_floating_point_v<TComponent>, std::is_unsigned_v<TComponent>, sizeof(TComponent) }
1004 : result),
1005 ...);
1006 }
1007 };
1008
1009
1010 static constexpr ComponentTypeTraits
1012 {
1013 return ComponentTypeTraits::Get<signed char,
1014 unsigned char,
1015 short,
1016 unsigned short,
1017 int,
1018 unsigned int,
1019 long,
1020 unsigned long,
1021 long long,
1022 unsigned long long,
1023 float,
1024 double>(componentEnum);
1025 }
1026
1027 bool
1028 HasSupportedExtension(const char *, const ArrayOfExtensionsType &, bool ignoreCase = true);
1029
1032};
1033
1035extern ITKIOImageBase_EXPORT void
1037 const void * buffer,
1038 std::ofstream & file,
1039 IOByteOrderEnum byteOrder,
1040 SizeValueType numberOfBytes,
1041 SizeValueType numberOfComponents);
1042
1044extern ITKIOImageBase_EXPORT void
1046 void * buffer,
1047 IOByteOrderEnum byteOrder,
1048 SizeValueType numberOfComponents);
1049
1050} // end namespace itk
1051
1052#endif // itkImageIOBase_h
Array class with size defined at construction time.
Definition itkArray.h:48
A templated class holding a n-Dimensional covariant vector.
Represent a diffusion tensor as used in DTI images.
Simulate a standard C array with copy semantics.
virtual unsigned int GetActualNumberOfSplitsForWriting(unsigned int numberOfRequestedSplits, const ImageIORegion &pasteRegion, const ImageIORegion &largestPossibleRegion)
void SetPixelTypeInfo(const VariableSizeMatrix< TValue > *)
virtual double GetOrigin(unsigned int i) const
~ImageIOBase() override
virtual ImageIORegion GetSplitRegionForWriting(unsigned int ithPiece, unsigned int numberOfActualSplits, const ImageIORegion &pasteRegion, const ImageIORegion &largestPossibleRegion)
std::vector< std::vector< double > > m_Direction
virtual void InternalSetCompressor(const std::string &_compressor)
bool ReadBufferAsBinary(std::istream &is, void *buffer, SizeType num)
virtual void Reset(const bool freeDynamic=true)
void AddSupportedReadExtension(const char *extension)
virtual double GetSpacing(unsigned int i) const
SmartPointer< const Self > ConstPointer
void SetByteOrderToBigEndian()
virtual void SetOrigin(unsigned int i, double origin)
std::vector< SizeValueType > m_Dimensions
void SetPixelTypeInfo(const RGBAPixel< TComponent > *)
itk::intmax_t SizeType
void SetPixelTypeInfo(const CovariantVector< TComponent, VLength > *)
virtual void OpenFileForWriting(std::ofstream &outputStream, const std::string &filename, bool truncate=true, bool ascii=false)
Opens a file for writing and random access.
virtual bool CanReadFile(const char *)=0
IOByteOrderEnum m_ByteOrder
virtual void SetNumberOfComponents(unsigned int _arg)
virtual void ReadBufferAsASCII(std::istream &is, void *buffer, IOComponentEnum ctype, SizeType numComp)
virtual bool HasSupportedWriteExtension(const char *fileName, bool ignoreCase=true)
void SetPixelTypeInfo(const SymmetricSecondRankTensor< TComponent, VLength > *)
virtual std::vector< double > GetDirection(unsigned int i) const
std::vector< double > m_Spacing
virtual unsigned int GetPixelSize() const
SizeType GetRowStride() const
virtual void SetComponentType(const IOComponentEnum _arg)
IOComponentEnum m_ComponentType
std::vector< double > m_Origin
virtual ImageIORegion GetSplitRegionForWritingCanStreamWrite(unsigned int ithPiece, unsigned int numberOfActualSplits, const ImageIORegion &pasteRegion) const
SizeType GetImageSizeInComponents() const
static constexpr IOComponentEnum GetComponentTypeFromTypeTraits(const bool isFloatingPoint, const bool isUnsigned, const vcl_size_t numberOfBits)
virtual void WriteBufferAsASCII(std::ostream &os, const void *buffer, IOComponentEnum ctype, SizeType numComp)
virtual void SetDirection(unsigned int i, const std::vector< double > &direction)
void SetSupportedReadExtensions(const ArrayOfExtensionsType &)
virtual void SetMaximumCompressionLevel(int)
std::string m_FileName
virtual unsigned int GetComponentSize() const
SizeType GetComponentStride() const
ArrayOfExtensionsType m_SupportedWriteExtensions
unsigned int m_NumberOfComponents
std::string GetByteOrderAsString(IOByteOrderEnum) const
void SetPixelTypeInfo(const FixedArray< TComponent, VLength > *)
virtual const ImageRegionSplitterBase * GetImageRegionSplitter() const
SizeType GetImageSizeInBytes() const
virtual bool SupportsDimension(unsigned long dim)
ArrayOfExtensionsType m_SupportedReadExtensions
virtual bool HasSupportedReadExtension(const char *fileName, bool ignoreCase=true)
virtual unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite(unsigned int numberOfRequestedSplits, const ImageIORegion &pasteRegion) const
virtual void SetCompressor(std::string _c)
Set/Get the compression algorithm to use.
const ArrayOfExtensionsType & GetSupportedReadExtensions() const
virtual bool CanStreamWrite()
static IOComponentEnum GetComponentTypeFromString(const std::string &typeString)
SmartPointer< Self > Pointer
bool HasSupportedExtension(const char *, const ArrayOfExtensionsType &, bool ignoreCase=true)
static IOPixelEnum GetPixelTypeFromString(const std::string &pixelString)
void SetPixelTypeInfo(const Offset< VLength > *)
void SetPixelTypeInfo(const Array< TValue > *)
void SetPixelTypeInfo(const Vector< TComponent, VLength > *)
virtual void SetByteOrder(const IOByteOrderEnum _arg)
virtual bool CanWriteFile(const char *)=0
virtual void Write(const void *buffer)=0
virtual void SetDirection(unsigned int i, const vnl_vector< double > &direction)
virtual ImageIORegion GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion &requested) const
itk::IOByteOrderEnum IOByteOrderEnum
void SetPixelTypeInfo(const Matrix< TComponent, VLength, VLength > *)
void SetByteOrderToLittleEndian()
void SetSupportedWriteExtensions(const ArrayOfExtensionsType &)
virtual SizeValueType GetDimensions(unsigned int i) const
static constexpr bool IsComponentTypeUnsigned(const IOComponentEnum componentEnum)
const ArrayOfExtensionsType & GetSupportedWriteExtensions() const
SizeType GetImageSizeInPixels() const
void Resize(const unsigned int numDimensions, const unsigned int *dimensions)
std::string GetFileTypeAsString(IOFileEnum) const
itk::OffsetValueType BufferSizeType
virtual void WriteImageInformation()=0
static constexpr vcl_size_t GetNumberOfBitsOfComponentType(const IOComponentEnum componentEnum)
itk::IOComponentEnum IOComponentEnum
IOPixelEnum m_PixelType
static std::string GetComponentTypeAsString(IOComponentEnum)
virtual void SetFileType(const IOFileEnum _arg)
std::vector< SizeType > m_Strides
LightProcessObject Superclass
static std::string GetPixelTypeAsString(IOPixelEnum)
unsigned int m_NumberOfDimensions
virtual void SetDimensions(unsigned int i, SizeValueType dim)
virtual void SetSpacing(unsigned int i, double spacing)
void SetPixelTypeInfo(const RGBPixel< TComponent > *)
void SetPixelTypeInfo(const VariableLengthVector< TComponent > *)
void SetPixelTypeInfo(const TPixel *)
ImageIORegion m_IORegion
static constexpr ComponentTypeTraits GetComponentTypeTraits(const IOComponentEnum componentEnum)
virtual void SetPixelType(const itk::CommonEnums::IOPixel _arg)
void SetNumberOfDimensions(unsigned int)
void SetPixelTypeInfo(const std::complex< TComponent > *)
itk::SizeValueType SizeValueType
virtual bool CanStreamRead()
void SetPixelTypeInfo(const DiffusionTensor3D< TComponent > *)
void AddSupportedWriteExtension(const char *extension)
virtual void ReadImageInformation()=0
static constexpr bool IsComponentTypeFloatingPoint(const IOComponentEnum componentEnum)
std::vector< std::string > ArrayOfExtensionsType
virtual std::vector< double > GetDefaultDirection(unsigned int k) const
IOFileEnum m_FileType
virtual void Read(void *buffer)=0
std::string m_Compressor
virtual void OpenFileForReading(std::ifstream &inputStream, const std::string &filename, bool ascii=false)
Opens a file for reading and random access.
itk::IOFileEnum IOFileEnum
virtual int GetMaximumCompressionLevel() const
virtual SizeType GetPixelStride() const
itk::IndexValueType IndexValueType
void PrintSelf(std::ostream &os, Indent indent) const override
SizeType GetSliceStride() const
void SetPixelTypeInfo(const Point< TCoordinate, VPointDimension > *)
An ImageIORegion represents a structured region of data.
Divide an image region into several pieces.
Control indentation during Print() invocation.
Definition itkIndent.h:50
A templated class holding a M x N size Matrix.
Definition itkMatrix.h:53
A templated class holding a geometric point in n-Dimensional space.
Definition itkPoint.h:54
Represent Red, Green, Blue and Alpha components for color images.
Represent Red, Green and Blue components for color images.
Definition itkRGBPixel.h:59
Implements transparent reference counting.
Represent a symmetric tensor of second rank.
A templated class holding a M x N size Matrix.
A templated class holding a n-Dimensional vector.
Definition itkVector.h:63
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
CommonEnums::IOComponent IOComponentEnum
unsigned long SizeValueType
Definition itkIntTypes.h:86
long OffsetValueType
Definition itkIntTypes.h:97
CommonEnums::IOFile IOFileEnum
CommonEnums::IOByteOrder IOByteOrderEnum
ITKIOImageBase_EXPORT void WriteRawBytesAfterSwapping(IOComponentEnum componentType, const void *buffer, std::ofstream &file, IOByteOrderEnum byteOrder, SizeValueType numberOfBytes, SizeValueType numberOfComponents)
CommonEnums::IOPixel IOPixelEnum
long IndexValueType
Definition itkIntTypes.h:93
ITKIOImageBase_EXPORT void ReadRawBytesAfterSwapping(IOComponentEnum componentType, void *buffer, IOByteOrderEnum byteOrder, SizeValueType numberOfComponents)
STL namespace.
static constexpr ComponentTypeTraits Get(const IOComponentEnum componentEnum)
static constexpr IOComponentEnum CType
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
Definition itkOffset.h:67