ITK  5.4.0
Insight Toolkit
itkGiplImageIO.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 itkGiplImageIO_h
19 #define itkGiplImageIO_h
20 #include "ITKIOGIPLExport.h"
21 
22 
23 #include <fstream>
24 #include "itkImageIOBase.h"
25 #include <cstdio>
26 #include <memory> // For unique_ptr.
27 
28 namespace itk
29 {
30 class GiplImageIOInternals;
31 
41 class ITKIOGIPL_EXPORT GiplImageIO : public ImageIOBase
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(GiplImageIO);
45 
47  using Self = GiplImageIO;
50 
52  itkNewMacro(Self);
53 
55  itkOverrideGetNameOfClassMacro(GiplImageIO);
56 
57  /*-------- This part of the interfaces deals with reading data. ----- */
58 
61  bool
62  CanReadFile(const char *) override;
63 
65  void
66  ReadImageInformation() override;
67 
69  void
70  Read(void * buffer) override;
71 
72  /*-------- This part of the interfaces deals with writing data. ----- */
73 
76  bool
77  CanWriteFile(const char *) override;
78 
80  void
81  WriteImageInformation() override;
82 
85  void
86  Write(const void * buffer) override;
87 
88  GiplImageIO();
89  ~GiplImageIO() override;
90  void
91  PrintSelf(std::ostream & os, Indent indent) const override;
92 
93 private:
94  void
95  SwapBytesIfNecessary(void * buffer, SizeValueType numberOfPixels);
96 
97  bool
98  CheckExtension(const char *);
99 
100  std::ifstream m_Ifstream{};
101  std::ofstream m_Ofstream{};
102  bool m_IsCompressed{};
103 
104  const std::unique_ptr<GiplImageIOInternals> m_Internal;
105 };
106 } // end namespace itk
107 
108 #endif // itkGiplImageIO_h
itk::ImageIOBase
Abstract superclass defines image IO interface.
Definition: itkImageIOBase.h:77
itk::ImageIOBase::SizeValueType
itk::SizeValueType SizeValueType
Definition: itkImageIOBase.h:98
itk::GiplImageIO
Read GIPL (Guy's Image Processing Lab) file format.
Definition: itkGiplImageIO.h:41
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GiplImageIO::m_Internal
const std::unique_ptr< GiplImageIOInternals > m_Internal
Definition: itkGiplImageIO.h:104
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkImageIOBase.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61