ITK  6.0.0
Insight Toolkit
itkJPEGImageIO.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 itkJPEGImageIO_h
19 #define itkJPEGImageIO_h
20 #include "ITKIOJPEGExport.h"
21 
22 
23 #include "itkImageIOBase.h"
24 
25 namespace itk
26 {
39 class ITKIOJPEG_EXPORT JPEGImageIO : public ImageIOBase
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(JPEGImageIO);
43 
45  using Self = JPEGImageIO;
48 
50  itkNewMacro(Self);
51 
53  itkOverrideGetNameOfClassMacro(JPEGImageIO);
54 
56  virtual void
57  SetQuality(int _JPEGQuality)
58  {
59  this->SetCompressionLevel(_JPEGQuality);
60  }
61  virtual int
62  GetQuality() const
63  {
64  return this->GetCompressionLevel();
65  }
69  itkSetMacro(Progressive, bool);
70  itkGetConstMacro(Progressive, bool);
71  itkBooleanMacro(Progressive);
75  itkSetMacro(CMYKtoRGB, bool);
76  itkGetConstMacro(CMYKtoRGB, bool);
77  itkBooleanMacro(CMYKtoRGB);
80  /*-------- This part of the interface deals with reading data. ------ */
81 
84  bool
85  CanReadFile(const char *) override;
86 
88  void
89  ReadImageInformation() override;
90 
92  void
93  Read(void * buffer) override;
94 
96  virtual void
97  ReadVolume(void * buffer);
98 
99  /*-------- This part of the interfaces deals with writing data. ----- */
100 
103  bool
104  CanWriteFile(const char *) override;
105 
108  void
109  WriteImageInformation() override;
110 
113  void
114  Write(const void * buffer) override;
115 
116 protected:
117  JPEGImageIO();
118  ~JPEGImageIO() override;
119  void
120  PrintSelf(std::ostream & os, Indent indent) const override;
121 
122  void
123  WriteSlice(const std::string & fileName, const void * const buffer);
124 
125  bool m_Progressive{ true };
126 
127  bool m_CMYKtoRGB{ true };
128 
129  bool m_IsCMYK{ false };
130 };
131 } // end namespace itk
132 
133 #endif // itkJPEGImageIO_h
itk::ImageIOBase
Abstract superclass defines image IO interface.
Definition: itkImageIOBase.h:77
itk::JPEGImageIO
ImageIO object for reading and writing JPEG images.
Definition: itkJPEGImageIO.h:39
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::JPEGImageIO::GetQuality
virtual int GetQuality() const
Definition: itkJPEGImageIO.h:62
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::JPEGImageIO::SetQuality
virtual void SetQuality(int _JPEGQuality)
Definition: itkJPEGImageIO.h:57
itkImageIOBase.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61