TTK
Loading...
Searching...
No Matches
ttkCinemaDarkroomNoise.cpp
Go to the documentation of this file.
2
3#include <ttkUtils.h>
4#include <vtkFloatArray.h>
5#include <vtkImageData.h>
6#include <vtkInformation.h>
7#include <vtkObjectFactory.h>
8#include <vtkPointData.h>
9
11
16
18 vtkInformationVector **inputVector,
19 vtkInformationVector *outputVector) {
20
21 auto inputImage = vtkImageData::GetData(inputVector[0]);
22 auto outputImage = vtkImageData::GetData(outputVector);
23 outputImage->ShallowCopy(inputImage);
24
25 size_t const nPoints = outputImage->GetNumberOfPoints();
26
28 noise->SetName("Noise");
29 noise->SetNumberOfTuples(nPoints);
30 auto noiseData = static_cast<float *>(ttkUtils::GetVoidPointer(noise));
31
32 int dim[3];
33 outputImage->GetDimensions(dim);
34
35 ttk::Timer const timer;
36 const std::string msg = "Computing Noise (" + std::to_string(dim[0]) + "x"
37 + std::to_string(dim[1]) + "x"
38 + std::to_string(dim[2]) + ")";
39
40 this->printMsg(msg, 0, 0, 1, ttk::debug::LineMode::REPLACE);
41
42 for(size_t i = 0; i < nPoints; i++)
43 noiseData[i] = ((float)std::rand()) / ((float)RAND_MAX);
44
45 this->printMsg(msg, 0, 0, 1);
46
47 outputImage->GetPointData()->AddArray(noise);
48
49 return 1;
50}
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
Definition BaseClass.h:47
~ttkCinemaDarkroomNoise() override
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Base Class for all CinemaDarkroom Shaders.
static void * GetVoidPointer(vtkDataArray *array, vtkIdType start=0)
Definition ttkUtils.cpp:226
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364
vtkStandardNewMacro(ttkCinemaDarkroomNoise)
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)