<div>I try to make project which is simillar with example Medical3.cxx</div>
<div>(I want to make another plane in Medical3.cxx)</div>
<div>but I don&#39;t know what is the SetDisplayExtent. there are 6 numbers behind that </div>
<div>so I try to change but there is nothing to happen.</div>
<div>this is the source of Medical3.cxx please tell me what is SetDisplayExtent and how do they perform in that program?</div>
<div> </div>
<div>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkVolume16Reader.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>
#include &quot;vtkActor.h&quot;<br>#include &quot;vtkOutlineFilter.h&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkStripper.h&quot;<br>#include &quot;vtkLookupTable.h&quot;<br>#include &quot;vtkImageDataGeometryFilter.h&quot;<br>
#include &quot;vtkProperty.h&quot;<br>#include &quot;vtkPolyDataNormals.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkImageData.h&quot;<br>#include &quot;vtkImageMapToColors.h&quot;<br>#include &quot;vtkImageActor.h&quot;</div>

<div>int main (int argc, char **argv)<br>{<br>  if (argc &lt; 2)<br>    {<br>      cout &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0] &lt;&lt; &quot; DATADIR/headsq/quarter&quot; &lt;&lt; endl;<br>    return 1;<br>    }</div>

<div>  // Create the renderer, the render window, and the interactor. The<br>  // renderer draws into the render window, the interactor enables<br>  // mouse- and keyboard-based interaction with the data within the<br>  // render window.<br>
  //<br>  vtkRenderer *aRenderer = vtkRenderer::New();<br>  vtkRenderWindow *renWin = vtkRenderWindow::New();<br>    renWin-&gt;AddRenderer(aRenderer);<br>  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
    iren-&gt;SetRenderWindow(renWin);</div>
<div>  // The following reader is used to read a series of 2D slices (images)<br>  // that compose the volume. The slice dimensions are set, and the<br>  // pixel spacing. The data Endianness must also be specified. The<br>
  // reader usese the FilePrefix in combination with the slice number to<br>  // construct filenames using the format FilePrefix.%d. (In this case<br>  // the FilePrefix is the root name of the file: quarter.)<br>  vtkVolume16Reader *v16 = vtkVolume16Reader::New();<br>
    v16-&gt;SetDataDimensions(64,64);<br>    v16-&gt;SetDataByteOrderToLittleEndian();<br>    v16-&gt;SetFilePrefix (argv[1]);<br>    v16-&gt;SetImageRange(1, 93);<br>    v16-&gt;SetDataSpacing (3.2, 3.2, 1.5);</div>
<div>  // An isosurface, or contour value of 500 is known to correspond to<br>  // the skin of the patient. Once generated, a vtkPolyDataNormals<br>  // filter is is used to create normals for smooth surface shading<br>  // during rendering.  The triangle stripper is used to create triangle<br>
  // strips from the isosurface; these render much faster on may<br>  // systems.<br>  vtkContourFilter *skinExtractor = vtkContourFilter::New();<br>    skinExtractor-&gt;SetInputConnection( v16-&gt;GetOutputPort());<br>    skinExtractor-&gt;SetValue(0, 500);<br>
  vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();<br>    skinNormals-&gt;SetInputConnection(skinExtractor-&gt;GetOutputPort());<br>    skinNormals-&gt;SetFeatureAngle(60.0);<br>  vtkStripper *skinStripper = vtkStripper::New();<br>
    skinStripper-&gt;SetInputConnection(skinNormals-&gt;GetOutputPort());<br>  vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();<br>    skinMapper-&gt;SetInputConnection(skinStripper-&gt;GetOutputPort());<br>    skinMapper-&gt;ScalarVisibilityOff();<br>
  vtkActor *skin = vtkActor::New();<br>    skin-&gt;SetMapper(skinMapper);<br>    skin-&gt;GetProperty()-&gt;SetDiffuseColor(1, .49, .25);<br>    skin-&gt;GetProperty()-&gt;SetSpecular(.3);<br>    skin-&gt;GetProperty()-&gt;SetSpecularPower(20);</div>

<div>  // An isosurface, or contour value of 1150 is known to correspond to<br>  // the skin of the patient. Once generated, a vtkPolyDataNormals<br>  // filter is is used to create normals for smooth surface shading<br>
  // during rendering.  The triangle stripper is used to create triangle<br>  // strips from the isosurface; these render much faster on may<br>  // systems.<br>  vtkContourFilter *boneExtractor = vtkContourFilter::New();<br>
    boneExtractor-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>    boneExtractor-&gt;SetValue(0, 1150);<br>  vtkPolyDataNormals *boneNormals = vtkPolyDataNormals::New();<br>    boneNormals-&gt;SetInputConnection(boneExtractor-&gt;GetOutputPort());<br>
    boneNormals-&gt;SetFeatureAngle(60.0);<br>  vtkStripper *boneStripper = vtkStripper::New();<br>    boneStripper-&gt;SetInputConnection(boneNormals-&gt;GetOutputPort());<br>  vtkPolyDataMapper *boneMapper = vtkPolyDataMapper::New();<br>
    boneMapper-&gt;SetInputConnection(boneStripper-&gt;GetOutputPort());<br>    boneMapper-&gt;ScalarVisibilityOff();<br>  vtkActor *bone = vtkActor::New();<br>    bone-&gt;SetMapper(boneMapper);<br>    bone-&gt;GetProperty()-&gt;SetDiffuseColor(1, 1, .9412);</div>

<div>  // An outline provides context around the data.<br>  //<br>  vtkOutlineFilter *outlineData = vtkOutlineFilter::New();<br>    outlineData-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>  vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();<br>
    mapOutline-&gt;SetInputConnection(outlineData-&gt;GetOutputPort());<br>  vtkActor *outline = vtkActor::New();<br>    outline-&gt;SetMapper(mapOutline);<br>    outline-&gt;GetProperty()-&gt;SetColor(0,0,0);</div>
<div>  // Now we are creating three orthogonal planes passing through the<br>  // volume. Each plane uses a different texture map and therefore has<br>  // different coloration.</div>
<div>  // Start by creatin a black/white lookup table.<br>  vtkLookupTable *bwLut = vtkLookupTable::New();<br>    bwLut-&gt;SetTableRange (0, 2000);<br>    bwLut-&gt;SetSaturationRange (0, 0);<br>    bwLut-&gt;SetHueRange (0, 0);<br>
    bwLut-&gt;SetValueRange (0, 1);<br>    bwLut-&gt;Build(); //effective built</div>
<div>  // Now create a lookup table that consists of the full hue circle<br>  // (from HSV).<br>  vtkLookupTable *hueLut = vtkLookupTable::New();<br>    hueLut-&gt;SetTableRange (0, 2000);<br>    hueLut-&gt;SetHueRange (0, 1);<br>
    hueLut-&gt;SetSaturationRange (1, 1);<br>    hueLut-&gt;SetValueRange (1, 1);<br>    hueLut-&gt;Build(); //effective built</div>
<div>  // Finally, create a lookup table with a single hue but having a range<br>  // in the saturation of the hue.<br>  vtkLookupTable *satLut = vtkLookupTable::New();<br>    satLut-&gt;SetTableRange (0, 2000);<br>    satLut-&gt;SetHueRange (.6, .6);<br>
    satLut-&gt;SetSaturationRange (0, 1);<br>    satLut-&gt;SetValueRange (1, 1);<br>    satLut-&gt;Build(); //effective built</div>
<div>  // Create the first of the three planes. The filter vtkImageMapToColors<br>  // maps the data through the corresponding lookup table created above.  The<br>  // vtkImageActor is a type of vtkProp and conveniently displays an image on<br>
  // a single quadrilateral plane. It does this using texture mapping and as<br>  // a result is quite fast. (Note: the input image has to be unsigned char<br>  // values, which the vtkImageMapToColors produces.) Note also that by<br>
  // specifying the DisplayExtent, the pipeline requests data of this extent<br>  // and the vtkImageMapToColors only processes a slice of data.<br>  vtkImageMapToColors *saggitalColors = vtkImageMapToColors::New();<br>    saggitalColors-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>
    saggitalColors-&gt;SetLookupTable(bwLut);<br>  vtkImageActor *saggital = vtkImageActor::New();<br>    saggital-&gt;SetInput(saggitalColors-&gt;GetOutput());<br>    saggital-&gt;SetDisplayExtent(32,32, 0,63, 0,92);</div>

<div>  // Create the second (axial) plane of the three planes. We use the<br>  // same approach as before except that the extent differs.<br>  vtkImageMapToColors *axialColors = vtkImageMapToColors::New();<br>    axialColors-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>
    axialColors-&gt;SetLookupTable(hueLut);<br>  vtkImageActor *axial = vtkImageActor::New();<br>    axial-&gt;SetInput(axialColors-&gt;GetOutput());<br>    axial-&gt;SetDisplayExtent(0,63, 0,63, 46,46);</div>
<div>  // Create the third (coronal) plane of the three planes. We use <br>  // the same approach as before except that the extent differs.<br>  vtkImageMapToColors *coronalColors = vtkImageMapToColors::New();<br>    coronalColors-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>
    coronalColors-&gt;SetLookupTable(satLut);<br>  vtkImageActor *coronal = vtkImageActor::New();<br>    coronal-&gt;SetInput(coronalColors-&gt;GetOutput());<br>    coronal-&gt;SetDisplayExtent(0,63, 32,32, 0,92);</div>
<div>  // It is convenient to create an initial view of the data. The<br>  // FocalPoint and Position form a vector direction. Later on<br>  // (ResetCamera() method) this vector is used to position the camera<br>  // to look at the data in this direction.<br>
  vtkCamera *aCamera = vtkCamera::New();<br>    aCamera-&gt;SetViewUp (0, 0, -1);<br>    aCamera-&gt;SetPosition (0, 1, 0);<br>    aCamera-&gt;SetFocalPoint (0, 0, 0);<br>    aCamera-&gt;ComputeViewPlaneNormal();</div>
<div>  // Actors are added to the renderer. <br>  aRenderer-&gt;AddActor(outline);<br>  aRenderer-&gt;AddActor(saggital);<br>  aRenderer-&gt;AddActor(axial);<br>  aRenderer-&gt;AddActor(coronal);<br>  aRenderer-&gt;AddActor(axial);<br>
  aRenderer-&gt;AddActor(coronal);<br>  aRenderer-&gt;AddActor(skin);<br>  aRenderer-&gt;AddActor(bone);</div>
<div>  // Turn off bone for this example.<br>  bone-&gt;VisibilityOff();</div>
<div>  // Set skin to semi-transparent.<br>  skin-&gt;GetProperty()-&gt;SetOpacity(0.5);</div>
<div>  // An initial camera view is created.  The Dolly() method moves <br>  // the camera towards the FocalPoint, thereby enlarging the image.<br>  aRenderer-&gt;SetActiveCamera(aCamera);<br>  aRenderer-&gt;Render();<br>
  aRenderer-&gt;ResetCamera ();<br>  aCamera-&gt;Dolly(1.5);</div>
<div>  // Set a background color for the renderer and set the size of the<br>  // render window (expressed in pixels).<br>  aRenderer-&gt;SetBackground(1,1,1);<br>  renWin-&gt;SetSize(640, 480);</div>
<div>  // Note that when camera movement occurs (as it does in the Dolly()<br>  // method), the clipping planes often need adjusting. Clipping planes<br>  // consist of two planes: near and far along the view direction. The <br>
  // near plane clips out objects in front of the plane; the far plane<br>  // clips out objects behind the plane. This way only what is drawn<br>  // between the planes is actually rendered.<br>  aRenderer-&gt;ResetCameraClippingRange ();</div>

<div>  // interact with data<br>  iren-&gt;Initialize();<br>  iren-&gt;Start(); </div>
<div>  // It is important to delete all objects created previously to prevent<br>  // memory leaks. In this case, since the program is on its way to<br>  // exiting, it is not so important. But in applications it is<br>  // essential.<br>
  v16-&gt;Delete();<br>  skinExtractor-&gt;Delete();<br>  skinNormals-&gt;Delete();<br>  skinStripper-&gt;Delete();<br>  skinMapper-&gt;Delete();<br>  skin-&gt;Delete();<br>  boneExtractor-&gt;Delete();<br>  boneNormals-&gt;Delete();<br>
  boneStripper-&gt;Delete();<br>  boneMapper-&gt;Delete();<br>  bone-&gt;Delete();<br>  outlineData-&gt;Delete();<br>  mapOutline-&gt;Delete();<br>  outline-&gt;Delete();<br>  bwLut-&gt;Delete();<br>  hueLut-&gt;Delete();<br>
  satLut-&gt;Delete();<br>  saggitalColors-&gt;Delete();<br>  saggital-&gt;Delete();<br>  axialColors-&gt;Delete();<br>  axial-&gt;Delete();<br>  coronalColors-&gt;Delete();<br>  coronal-&gt;Delete();<br>  aCamera-&gt;Delete();<br>
  aRenderer-&gt;Delete();<br>  renWin-&gt;Delete();<br>  iren-&gt;Delete();</div>
<div>  return 0;<br>}<br></div>
<div> </div>