<div>hi all,</div>
<div>I am working on creating a UI using KWWidgets.</div>
<div>I want to display a 3D volume in this UI from 2D BMP slices.</div>
<div>The volume rendering is working fine without the UI.But I seem to have some problem with the UI.</div>
<div>It displays the UI window, but I cannot see the 3D volume inside it.</div>
<div>Addionally on running the program I get the following error on the vtkoutput window.</div>
<div>
<p>ERROR: In C:\Program Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWTkUtilities.cxx, line 221<br>vtkKWApplication (0x03414370): <br>&nbsp;&nbsp;&nbsp; Script: <br>vtkTkRenderWidget .1.10.18.21.22.25.100.102.104.107.108 -rw Addr=03428710<br>
&nbsp;&nbsp;&nbsp; Returned Error on line 1: <br>invalid command name &quot;vtkTkRenderWidget&quot;<br>Stack trace: <br>invalid command name &quot;vtkTkRenderWidget&quot;<br>&nbsp;&nbsp;&nbsp; while executing<br>&quot;vtkTkRenderWidget .1.10.18.21.22.25.100.102.104.107.108 -rw Addr=03428710&quot;
</p>
<p><br>ERROR: In C:\Program Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWWidget.cxx, line 301<br>vtkKWCoreWidget (0x03428990): Error creating the widget .1.10.18.21.22.25.100.102.104.107.108 of type vtkTkRenderWidget: invalid command name &quot;vtkTkRenderWidget&quot;
</p>
<p>ERROR: In C:\Program Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWTkUtilities.cxx, line 221<br>vtkKWApplication (0x03414370): <br>&nbsp;&nbsp;&nbsp; Script: <br>grid .1.10.18.21.22.25.100.102.104.107.108 -row 0 -column 0 -sticky nsew<br>
&nbsp;&nbsp;&nbsp; Returned Error on line 1: <br>bad window path name &quot;.1.10.18.21.22.25.100.102.104.107.108&quot;<br>Stack trace: <br>bad window path name &quot;.1.10.18.21.22.25.100.102.104.107.108&quot;<br>&nbsp;&nbsp;&nbsp; while executing<br>
&quot;grid .1.10.18.21.22.25.100.102.104.107.108 -row 0 -column 0 -sticky nsew&quot;</p>
<p><br>ERROR: In C:\Program Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWApplication.cxx, line 999<br>vtkKWApplication (0x03414370): TclTk error: Object named: vtkTemp44, could not find requested method: ConfigureCallback<br>
or the method was called with incorrect arguments.</p>
<p>Object named: vtkTemp44, could not find requested method: ConfigureCallback<br>or the method was called with incorrect arguments.</p>
<p>&nbsp;&nbsp;&nbsp; while executing<br>&quot;vtkTemp44 ConfigureCallback 900 668&quot;<br>&nbsp;&nbsp;&nbsp; (command bound to event)</p>
<p>&nbsp;Here is my code</p>
<p>//The following code includes the vtk code and the KWWidgets code for the user interface.<br>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;
<br>#include &quot;vtkBMPReader.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>#include &quot;vtkActor.h&quot;<br>#include &quot;vtkActor2D.h&quot;<br>#include &quot;vtkImageActor.h&quot;<br>#include &quot;vtkOutlineFilter.h
&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkProperty.h&quot;<br>#include &quot;vtkPolyDataNormals.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkDataSetMapper.h&quot;<br>#include &quot;
vtkImageMapper.h&quot;<br>#include &quot;vtkVolumeMapper.h&quot;<br>#include &quot;vtkVolumeRayCastMapper.h&quot;<br>#include &quot;vtkVolumeRayCastCompositeFunction.h&quot;<br>#include &quot;vtkPiecewiseFunction.h&quot;<br>
#include &quot;vtkVolumeProperty.h&quot;<br>#include &quot;vtkColorTransferFunction.h&quot;<br>#include &quot;vtkLight.h&quot;<br>#include &quot;vtkFixedPointVolumeRayCastMapper.h&quot;<br>#include &quot;vtkKWApplication.h
&quot;<br>#include &quot;vtkKWWindowBase.h&quot;<br>#include &quot;vtkKWRenderWidget.h&quot;<br>#include &quot;vtkKWWindow.h&quot;<br>#include &quot;vtkKWFrame.h&quot;</p>
<p>int main(int argc, char *argv[])<br>{<br>&nbsp;<br>&nbsp;// Initialize Tcl.This is required otherwise the program crashes.<br>&nbsp;<br>&nbsp;Tcl_Interp *interp = vtkKWApplication::InitializeTcl(argc, argv, &amp;cerr);<br>&nbsp; if (!interp)<br>
&nbsp; {<br>&nbsp; cerr &lt;&lt; &quot;Error: InitializeTcl failed&quot; &lt;&lt; endl ;<br>&nbsp; return 1;<br>&nbsp; }</p>
<p><br>//using bmp to read gray image<br>&nbsp;vtkBMPReader *reader = vtkBMPReader::New();<br>&nbsp;reader-&gt;SetFilePattern(&quot;%s%d.bmp&quot;);<br>&nbsp;<br>&nbsp;&nbsp;reader-&gt;SetFilePrefix(&quot;C:\\Images\\PositionCReal\\Depth5mm\\slice&quot;);
<br>&nbsp;<br>&nbsp;<br>&nbsp;reader-&gt;SetDataExtent(0, 310, 0, 310, 1, 8);<br>&nbsp;reader-&gt;SetDataSpacing(1.0,1.0,20.0);<br>&nbsp;reader-&gt;SetDataOrigin(0.0, 0.0, 0.0);<br>&nbsp;reader-&gt;Update();<br>&nbsp;<br>&nbsp; <br>&nbsp;//vtkImageData *finalImg = reader-&gt;GetOutput();
<br>&nbsp;<br>&nbsp; <br>&nbsp;vtkPiecewiseFunction *tfun = vtkPiecewiseFunction::New();</p>
<p>//The following lines of code displays the copper target for position A and C<br>&nbsp;tfun-&gt;AddPoint(128,0.009);<br>&nbsp;tfun-&gt;AddPoint(180,1.0);<br>&nbsp;tfun-&gt;AddPoint(200,1.0);<br>&nbsp;tfun-&gt;AddPoint(255,0.0009);</p>
<p>&nbsp;&nbsp;vtkFixedPointVolumeRayCastMapper *volumeMapper = vtkFixedPointVolumeRayCastMapper::New();<br>&nbsp;<br>&nbsp;//volumeMapper-&gt;SetSampleDistance(1.0);</p>
<p>&nbsp;//volumeMapper-&gt;SetInput(finalImg);<br>&nbsp;volumeMapper-&gt;SetInput(reader-&gt;GetOutput());</p>
<p>&nbsp;vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();</p>
<p>&nbsp; //show gray volume<br>&nbsp;volumeProperty-&gt;IndependentComponentsOff();<br>&nbsp;volumeProperty-&gt;SetScalarOpacity(tfun);<br>&nbsp;&nbsp;<br><br>&nbsp;<br>&nbsp;vtkVolume *newvol = vtkVolume::New();<br>&nbsp;newvol-&gt;SetMapper(volumeMapper);<br>
&nbsp;newvol-&gt;SetProperty(volumeProperty);</p>
<p>&nbsp;vtkOutlineFilter *outline = vtkOutlineFilter::New();<br>&nbsp;outline-&gt;SetInput((vtkDataSet *) reader-&gt;GetOutput());</p>
<p>&nbsp;vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();<br>&nbsp;outlineMapper-&gt;SetInput(outline-&gt;GetOutput());</p>
<p>&nbsp;vtkActor *outlineActor = vtkActor::New();<br>&nbsp;outlineActor-&gt;SetMapper(outlineMapper);<br>&nbsp;outlineActor-&gt;GetProperty()-&gt;SetColor(1,1,1);</p>
<p>&nbsp;</p>
<p>&nbsp;//Create a KWWidgets Application<br>&nbsp;vtkKWApplication *app = vtkKWApplication::New();<br>&nbsp;app-&gt;SetRegistryLevel(0);<br>&nbsp;app-&gt;PromptBeforeExitOff();</p>
<p>&nbsp;&nbsp;&nbsp;<br>&nbsp;vtkKWTopLevel *top = vtkKWTopLevel::New();<br>&nbsp;top-&gt;SetApplication(app);<br>&nbsp;top-&gt;Create(); <br>&nbsp;</p>
<p>&nbsp;//Add a window for the application<br>&nbsp;vtkKWWindow *win = vtkKWWindow::New();<br>&nbsp;app-&gt;AddWindow(win);<br>&nbsp;win-&gt;SecondaryPanelVisibilityOff();<br>&nbsp;win-&gt;MainPanelVisibilityOff();<br>&nbsp;win-&gt;Create();</p>
<p><br>&nbsp;vtkKWRenderWidget *renderwidget = vtkKWRenderWidget::New();<br>&nbsp;renderwidget-&gt;SetParent(win-&gt;GetViewFrame());<br>&nbsp;renderwidget-&gt;Create();<br>&nbsp;renderwidget-&gt;AddViewProp(newvol);<br>&nbsp;renderwidget-&gt;CornerAnnotationVisibilityOn();
<br>&nbsp;app-&gt;Script(&quot;pack %s -expand y -fill both -anchor c -expand y&quot;,renderwidget-&gt;GetWidgetName());<br>&nbsp;<br>&nbsp;win-&gt;Display();<br>&nbsp;app-&gt;Start();</p>
<p>&nbsp;<br>&nbsp;<br>&nbsp;win-&gt;Display();<br>&nbsp;app-&gt;Start();</p>
<p><br>&nbsp;return(0);</p>
<p>}<br></p>
<p>Can someone please help me out.</p>
<p>Thanks&nbsp;</p>
<p>Sharwari&nbsp;</p>
<p>&nbsp;</p>
<p><br>&nbsp;</p></div>