If (arg c & lt; 2)
{
STD: : cout
}
VtkSmartPointer
VtkSmartPointer
Reader - & gt; SetFileName (argv [1]);
Reader - & gt; The Update ();
Int among [6].
Double spacing [3].
A double origin [3].
Reader - & gt; GetOutput () - & gt; GetExtent (among);
Reader - & gt; GetOutput () - & gt; GetSpacing (spacing);
Reader - & gt; GetOutput () - & gt; GetOrigin (origin);
Double center [3].
Center [0]=origin [0] + spacing [0] * 0.5 * (among other among [0] + [1]).
Center [1]=origin spacing [1] + [1] * 0.5 * (among other + among [2] [3]).
Center [2]=origin [2] + spacing [2] * 0.5 * (among other among [4] + [5]);
The static double axialElements [16]={
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
VtkSmartPointer
ResliceAxes - & gt; SetElement (0, 3, center [0]).
ResliceAxes - & gt; SetElement (1, 3, center [1]).
ResliceAxes - & gt; SetElement (2, 3, center [2]).
VtkSmartPointer
VtkSmartPointer
Reslice - & gt; SetInputConnection (reader - & gt; GetOutputPort ());
Reslice - & gt; SetOutputDimensionality (2);
Reslice - & gt; SetResliceAxes (resliceAxes);
Reslice - & gt; SetInterpolationModeToLinear ();
VtkSmartPointer
VtkSmartPointer
ColorTable - & gt; SetRange (0, 1000);
ColorTable - & gt; SetValueRange (0.0, 1.0);
ColorTable - & gt; SetSaturationRange (0.0, 0.0);
ColorTable - & gt; SetRampToLinear ();
ColorTable - & gt; Build ();
VtkSmartPointer
VtkSmartPointer
ColorMap - & gt; SetLookupTable (colorTable);
ColorMap - & gt; SetInputConnection (reslice - & gt; GetOutputPort ());
VtkSmartPointer
VtkSmartPointer
ImgActor - & gt; SetInputData (colorMap - & gt; GetOutput ());
VtkSmartPointer
VtkSmartPointer
The renderer - & gt; AddActor (imgActor);
The renderer - & gt; SetBackground (1.0, 1.0, 1.0);
VtkSmartPointer
VtkSmartPointer
RenderWindow - & gt; AddRenderer (the renderer);
RenderWindow - & gt; Render ();
RenderWindow - & gt; SetSize (640, 480);
RenderWindow - & gt; ImageResliceExample SetWindowName (" ");
VtkSmartPointer
VtkSmartPointer
VtkSmartPointer
VtkSmartPointer
RenderWindowInteractor - & gt; SetInteractorStyle (imagestyle);
RenderWindowInteractor - & gt; SetRenderWindow (renderWindow);
RenderWindowInteractor - & gt; The Initialize ();
RenderWindowInteractor - & gt; Start ().
Return EXIT_SUCCESS;
Results no error, no display graphical
CodePudding user response:
To set breakpoints single-step debugging, look at the file open, etc. If there is something wrong?CodePudding user response:
Plus the colorMap - & gt; The update ()