ITK  5.2.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  * 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 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);
80 
100 class ITKIOJPEG2000_EXPORT JPEG2000ImageIO : public StreamingImageIOBase
101 {
102 public:
103  ITK_DISALLOW_COPY_AND_ASSIGN(JPEG2000ImageIO);
104 
109 
111  itkNewMacro(Self);
112 
114  itkTypeMacro(JPEG2000ImageIO, StreamingImageIOBase);
115 
116  /*-------- This part of the interfaces deals with reading data. ----- */
117 
120  bool
121  CanReadFile(const char *) override;
122 
124  void
125  ReadImageInformation() override;
126 
128  void
129  Read(void * buffer) override;
130 
131  /*-------- This part of the interfaces deals with writing data. ----- */
132 
135  bool
136  CanWriteFile(const char *) override;
137 
139  void
140  WriteImageInformation() override;
141 
144  void
145  Write(const void * buffer) override;
146 
152  GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion & requested) const override;
153 
155  SizeType
156  GetHeaderSize() const override;
157 
159  void
160  SetTileSize(int x, int y);
161 
167  bool
168  CanStreamWrite() override;
169 
170 protected:
171  JPEG2000ImageIO();
172  ~JPEG2000ImageIO() override;
173 
174  void
175  PrintSelf(std::ostream & os, Indent indent) const override;
176 
177 private:
178  std::unique_ptr<JPEG2000ImageIOInternal> m_Internal;
179 
182 
183  void
184  ComputeRegionInTileBoundaries(unsigned int dimension, SizeValueType tileSize, ImageIORegion & streamableRegion) const;
185 };
186 } // end namespace itk
187 
188 #endif // itkJPEG2000ImageIO_h
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::JPEG2000ImageIOInternalEnums::DFMFormat::PXM_DFMT
itk::ImageIORegion::SizeValueType
::itk::SizeValueType SizeValueType
Definition: itkImageIORegion.h:61
itkStreamingImageIOBase.h
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:213
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::JPT_CFMT
itk::StreamingImageIOBase
A base class for specific ImageIO file formats which support streaming.
Definition: itkStreamingImageIOBase.h:52
itk::ImageIOBase::IndexValueType
::itk::IndexValueType IndexValueType
Definition: itkImageIOBase.h:95
itk::JPEG2000ImageIOInternalEnums::DFMFormat::BMP_DFMT
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::JP2_CFMT
itk::JPEG2000ImageIO::m_Internal
std::unique_ptr< JPEG2000ImageIOInternal > m_Internal
Definition: itkJPEG2000ImageIO.h:178
itk::ImageIORegion::IndexValueType
::itk::IndexValueType IndexValueType
Definition: itkImageIORegion.h:62
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:59
itk::JPEG2000ImageIO
Supports for the JPEG2000 file format based on openjpeg.
Definition: itkJPEG2000ImageIO.h:100
itk::JPEG2000ImageIOInternalEnums::DecodingFormat
DecodingFormat
Definition: itkJPEG2000ImageIO.h:44
itk::JPEG2000ImageIOInternalEnums::DFMFormat::YUV_DFMT
itk::ImageIOBase::SizeValueType
::itk::SizeValueType SizeValueType
Definition: itkImageIOBase.h:96
itk::JPEG2000ImageIOInternalEnums
This class contains all enum classes used by JPEG2000ImageIOInternal class.
Definition: itkJPEG2000ImageIO.h:37
DecodingFormat
itk::JPEG2000ImageIOInternalEnums::DFMFormat::PGX_DFMT
itk::ImageIOBase::SizeType
::itk::intmax_t SizeType
Definition: itkImageIOBase.h:393
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:62
DFMFormat
itk::JPEG2000ImageIOInternalEnums::DFMFormat
DFMFormat
Definition: itkJPEG2000ImageIO.h:66
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::J2K_CFMT
itk::JPEG2000ImageIOInternalEnums::DecodingFormat::MJ2_CFMT