MCPcopy Create free account
hub / github.com/Kitware/VTK / TestRGBToLAB

Function TestRGBToLAB

Imaging/Color/Testing/Cxx/TestRGBToLAB.cxx:13–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include "vtkXMLImageDataWriter.h"
12
13int TestRGBToLAB(int argc, char* argv[])
14{
15 char* input = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/vtk.png");
16 char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/rgb2lab.vti");
17
18 vtkNew<vtkXMLImageDataReader> reader;
19 reader->SetFileName(fname);
20 reader->Update();
21
22 vtkNew<vtkPNGReader> inputReader;
23 inputReader->SetFileName(input);
24
25 vtkNew<vtkImageShiftScale> normalizer;
26 normalizer->SetScale(1.0 / 255);
27
28 vtkNew<vtkImageRGBToXYZ> rgb2xyz;
29 vtkNew<vtkImageXYZToLAB> xyz2lab;
30
31 normalizer->SetInputConnection(inputReader->GetOutputPort());
32 rgb2xyz->SetInputConnection(normalizer->GetOutputPort());
33 xyz2lab->SetInputConnection(rgb2xyz->GetOutputPort());
34
35 xyz2lab->Update();
36
37 return vtkTestUtilities::CompareDataObjects(
38 xyz2lab->GetOutputDataObject(0), reader->GetOutputDataObject(0))
39 ? EXIT_SUCCESS
40 : EXIT_FAILURE;
41}

Callers

nothing calls this directly

Calls 6

SetFileNameMethod · 0.45
UpdateMethod · 0.45
SetScaleMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
GetOutputDataObjectMethod · 0.45

Tested by

no test coverage detected