1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkImageMagnify.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 // .NAME vtkImageMagnify - magnify an image by an integer value
16 // .SECTION Description
17 // vtkImageMagnify maps each pixel of the input onto a nxmx... region
18 // of the output.  Location (0,0,...) remains in the same place. The
19 // magnification occurs via pixel replication, or if Interpolate is on,
20 // by bilinear interpolation. Initially, interpolation is off and magnification
21 // factors are set to 1 in all directions.
22 
23 #ifndef vtkImageMagnify_h
24 #define vtkImageMagnify_h
25 
26 #include "vtkImagingCoreModule.h" // For export macro
27 #include "vtkThreadedImageAlgorithm.h"
28 
29 class VTKIMAGINGCORE_EXPORT vtkImageMagnify : public vtkThreadedImageAlgorithm
30 {
31 public:
32   static vtkImageMagnify *New();
33   vtkTypeMacro(vtkImageMagnify,vtkThreadedImageAlgorithm);
34   void PrintSelf(ostream& os, vtkIndent indent);
35 
36   // Description:
37   // Set/Get the integer magnification factors in the i-j-k directions.
38   // Initially, factors are set to 1 in all directions.
39   vtkSetVector3Macro(MagnificationFactors,int);
40   vtkGetVector3Macro(MagnificationFactors,int);
41 
42   // Description:
43   // Turn interpolation on and off (pixel replication is used when off).
44   // Initially, interpolation is off.
45   vtkSetMacro(Interpolate,int);
46   vtkGetMacro(Interpolate,int);
47   vtkBooleanMacro(Interpolate,int);
48 
49 protected:
50   vtkImageMagnify();
~vtkImageMagnify()51   ~vtkImageMagnify() {}
52 
53   int MagnificationFactors[3];
54   int Interpolate;
55   virtual int RequestUpdateExtent(vtkInformation *,
56                                   vtkInformationVector **,
57                                   vtkInformationVector *);
58   virtual int RequestInformation(vtkInformation *,
59                                  vtkInformationVector **,
60                                  vtkInformationVector *);
61 
62   void ThreadedRequestData(vtkInformation *request,
63                            vtkInformationVector **inputVector,
64                            vtkInformationVector *outputVector,
65                            vtkImageData ***inData,
66                            vtkImageData **outData,
67                            int outExt[6],
68                            int id);
69 
70   void InternalRequestUpdateExtent(int *inExt, int *outExt);
71 
72 private:
73   vtkImageMagnify(const vtkImageMagnify&);  // Not implemented.
74   void operator=(const vtkImageMagnify&);  // Not implemented.
75 };
76 
77 #endif
78 
79 
80 
81 
82