1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkJPEGReader.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /**
16  * @class   vtkJPEGReader
17  * @brief   read JPEG files
18  *
19  * vtkJPEGReader is a source object that reads JPEG files.
20  * The reader can also read an image from a memory buffer,
21  * see vtkImageReader2::MemoryBuffer.
22  * It should be able to read most any JPEG file.
23  *
24  * @sa
25  * vtkJPEGWriter
26  */
27 
28 #ifndef vtkJPEGReader_h
29 #define vtkJPEGReader_h
30 
31 #include "vtkIOImageModule.h" // For export macro
32 #include "vtkImageReader2.h"
33 
34 class VTKIOIMAGE_EXPORT vtkJPEGReader : public vtkImageReader2
35 {
36 public:
37   static vtkJPEGReader* New();
38   vtkTypeMacro(vtkJPEGReader, vtkImageReader2);
39   void PrintSelf(ostream& os, vtkIndent indent) override;
40 
41   /**
42    * Is the given file a JPEG file?
43    */
44   int CanReadFile(VTK_FILEPATH const char* fname) override;
45 
46   /**
47    * Get the file extensions for this format.
48    * Returns a string with a space separated list of extensions in
49    * the format .extension
50    */
GetFileExtensions()51   const char* GetFileExtensions() override { return ".jpeg .jpg"; }
52 
53   /**
54    * Return a descriptive name for the file format that might be useful in a GUI.
55    */
GetDescriptiveName()56   const char* GetDescriptiveName() override { return "JPEG"; }
57 
58 protected:
59   vtkJPEGReader() = default;
60   ~vtkJPEGReader() override = default;
61 
62   template <class OT>
63   void InternalUpdate(vtkImageData* data, OT* outPtr);
64 
65   void ExecuteInformation() override;
66   void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
67 
68 private:
69   vtkJPEGReader(const vtkJPEGReader&) = delete;
70   void operator=(const vtkJPEGReader&) = delete;
71 };
72 #endif
73