File: vtkSMUtilities.h

package info (click to toggle)
paraview 5.1.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 221,108 kB
  • ctags: 236,092
  • sloc: cpp: 2,416,026; ansic: 190,891; python: 99,856; xml: 81,001; tcl: 46,915; yacc: 5,039; java: 4,413; perl: 3,108; sh: 1,974; lex: 1,926; f90: 748; asm: 471; pascal: 228; makefile: 198; objc: 83; fortran: 31
file content (101 lines) | stat: -rw-r--r-- 4,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*=========================================================================

  Program:   ParaView
  Module:    vtkSMUtilities.h

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkSMUtilities - collection of utility methods.
// .SECTION Description
// vtkSMUtilities defines a collection of useful static methods.

#ifndef vtkSMUtilities_h
#define vtkSMUtilities_h

#include "vtkPVServerManagerRenderingModule.h" //needed for exports
#include "vtkSMObject.h"
#include "vtkSmartPointer.h" // needed for vtkSmartPointer
#include <vector> // needed for std::vector

class vtkImageData;
class vtkPoints;
class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMUtilities : public vtkSMObject
{
public:
  static vtkSMUtilities* New();
  vtkTypeMacro(vtkSMUtilities, vtkSMObject);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Save the image to a file.
  // The file is created on the process on which this method is called.
  // Return vtkErrorCode::NoError (0) on success, otherwise returns the error
  // code.
  /// quality [0,100] -- 0 = low, 100=high, -1=default
  static int SaveImage(vtkImageData* image, const char* filename, 
    int quality);
  static int SaveImage(vtkImageData* image, const char* filename)
    { return vtkSMUtilities::SaveImage(image, filename, -1); }

  // Description:
  // Save the image to a file using a vtkImageWriter subclass given by writerName.
  // The file is created on the process on which this method is called.
  static int SaveImage(vtkImageData* image, const char* filename,
                                          const char* writerName);

  // Description:
  // Calls SaveImage(image, filename, writerName) only on process 0.
  // Other processes will recieve the return code through a broadcast.
  static int SaveImageOnProcessZero(vtkImageData* image,
                const char* filename, const char* writerName);

  // Description:
  // Returns the points an orbit to revolve around the \c center at a distance
  // of \c radius in the plane defined by the \c center and the \c normal. The
  // number of points returned is equal to \c resolution.
  // Returns a new instance of vtkPoints. The caller is responsible for freeing
  // the allocated memory.
  static vtkPoints* CreateOrbit(const double center[3], const double normal[3],
                                int resolution, const double startPoint[3]);

  // Will pick an arbitrary starting point
  static vtkPoints* CreateOrbit(const double center[3], const double normal[3],
                                double radius, int resolution);

  // Description:
  // Convenience method used to merge a smaller image (\c src) into a
  // larger one (\c dest). The location of the smaller image in the larger image
  // are determined by their extents.
  static void Merge(vtkImageData* dest, vtkImageData* src,
    int borderWidth=0, const unsigned char* borderColorRGB=NULL);

  // Description:
  // Merges multiple images into a single one and returns that.
  static vtkSmartPointer<vtkImageData> MergeImages(
    const std::vector<vtkSmartPointer<vtkImageData> >& images,
    int borderWidth=0, const unsigned char* borderColorRGB=NULL);

  // Description:
  // Fill the specified extents in the image with the given color.
  // If the image is a 4 component image, then this method fills the 4th
  // component with 0xff.
  static void FillImage(vtkImageData* image, const int extent[6], const unsigned char rgb[3]);

protected:
  vtkSMUtilities() {}
  ~vtkSMUtilities(){}

private:
  vtkSMUtilities(const vtkSMUtilities&); // Not implemented
  void operator=(const vtkSMUtilities&); // Not implemented

};

#endif