ITK  5.4.0
Insight Toolkit
itkJPEG2000ImageIO.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 itkJPEG2000ImageIO_h
19 #define itkJPEG2000ImageIO_h
20 
21 
22 #include <fstream>
23 #include "ITKIOJPEG2000Export.h"
25 #include "memory"
26 
27 
28 namespace itk
29 {
30 
31 class JPEG2000ImageIOInternal;
32 class JPEG2000ImageIOInternalEnums;
38 {
39 public:
44  enum class DecodingFormat : uint8_t
45  {
46  J2K_CFMT = 0,
47  JP2_CFMT = 1,
48  JPT_CFMT = 2,
49  MJ2_CFMT = 3
50  };
51 
57  enum class DecodingFormat : uint8_t
58  {
59  J2K_CFMT = 0,
60  JP2_CFMT = 1,
61  JPT_CFMT = 2,
62  MJ2_CFMT = 3
63  };
64  * \ingroup ITKIOJPEG2000
65  * */
66  enum class DFMFormat : uint8_t
67  {
68  PXM_DFMT = 0,
69  PGX_DFMT = 1,
70  BMP_DFMT = 2,
71  YUV_DFMT = 3
72  };
73 };
74 // Define how to print enumeration
75 extern ITKIOJPEG2000_EXPORT std::ostream &
76  operator<<(std::ostream & out, const JPEG2000ImageIOInternalEnums::DecodingFormat value);
77 extern ITKIOJPEG2000_EXPORT std::ostream &
78  operator<<(std::ostream & out, const JPEG2000ImageIOInternalEnums::DFMFormat value);
99 class ITKIOJPEG2000_EXPORT JPEG2000ImageIO : public StreamingImageIOBase
100 {
101 public:
102  ITK_DISALLOW_COPY_AND_MOVE(JPEG2000ImageIO);
103 
108 
110  itkNewMacro(Self);
111 
113  itkOverrideGetNameOfClassMacro(JPEG2000ImageIO);
114 
115  /*-------- This part of the interfaces deals with reading data. ----- */
116 
119  bool
120  CanReadFile(const char *) override;
121 
123  void
124  ReadImageInformation() override;
125 
127  void
128  Read(void * buffer) override;
129 
130  /*-------- This part of the interfaces deals with writing data. ----- */
131 
134  bool
135  CanWriteFile(const char *) override;
136 
138  void
139  WriteImageInformation() override;
140 
143  void
144  Write(const void * buffer) override;
145 
151  GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion & requestedRegion) const override;
152 
154  SizeType
155  GetHeaderSize() const override;
156 
158  void
159  SetTileSize(int x, int y);
160 
166  bool
167  CanStreamWrite() override;
168 
169 protected:
170  JPEG2000ImageIO();
171  ~JPEG2000ImageIO() override;
172 
173  void
174  PrintSelf(std::ostream & os, Indent indent) const override;
175 
176 private:
177  std::unique_ptr<JPEG2000ImageIOInternal> m_Internal;
178 
181 
182  void
183  ComputeRegionInTileBoundaries(unsigned int dimension, SizeValueType tileSize, ImageIORegion & streamableRegion) const;
184 };
185 } // end namespace itk
186 
187 #endif // itkJPEG2000ImageIO_h
itk::ImageIOBase::SizeValueType
itk::SizeValueType SizeValueType
Definition: itkImageIOBase.h:98
itk::JPEG2000ImageIOInternalEnums::DFMFormat::PXM_DFMT
itkStreamingImageIOBase.h
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:216
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::JPT_CFMT
itk::StreamingImageIOBase
A base class for specific ImageIO file formats which support streaming.
Definition: itkStreamingImageIOBase.h:52
itk::JPEG2000ImageIOInternalEnums::DFMFormat::BMP_DFMT
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::JP2_CFMT
itk::JPEG2000ImageIO::m_Internal
std::unique_ptr< JPEG2000ImageIOInternal > m_Internal
Definition: itkJPEG2000ImageIO.h:177
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageIORegion
An ImageIORegion represents a structured region of data.
Definition: itkImageIORegion.h:52
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::JPEG2000ImageIO
Supports for the JPEG2000 file format based on openjpeg.
Definition: itkJPEG2000ImageIO.h:99
itk::JPEG2000ImageIOInternalEnums::DecodingFormat
DecodingFormat
Definition: itkJPEG2000ImageIO.h:44
itk::JPEG2000ImageIOInternalEnums::DFMFormat::YUV_DFMT
itk::ImageIORegion::IndexValueType
itk::IndexValueType IndexValueType
Definition: itkImageIORegion.h:62
itk::JPEG2000ImageIOInternalEnums
This class contains all enum classes used by JPEG2000ImageIOInternal class.
Definition: itkJPEG2000ImageIO.h:37
DecodingFormat
itk::JPEG2000ImageIOInternalEnums::DFMFormat::PGX_DFMT
itk::ImageIOBase::IndexValueType
itk::IndexValueType IndexValueType
Definition: itkImageIOBase.h:97
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageIOBase::SizeType
itk::intmax_t SizeType
Definition: itkImageIOBase.h:395
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
DFMFormat
itk::JPEG2000ImageIOInternalEnums::DFMFormat
DFMFormat
Definition: itkJPEG2000ImageIO.h:66
itk::ImageIORegion::SizeValueType
itk::SizeValueType SizeValueType
Definition: itkImageIORegion.h:61
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::J2K_CFMT
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::MJ2_CFMT