<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>    Script: <br>vtkTkRenderWidget .1.10.18.21.22.25.100.102.104.107.108 -rw Addr=03428710<br>
    Returned Error on line 1: <br>invalid command name "vtkTkRenderWidget"<br>Stack trace: <br>invalid command name "vtkTkRenderWidget"<br>    while executing<br>"vtkTkRenderWidget .1.10.18.21.22.25.100.102.104.107.108 -rw Addr=03428710"
</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 "vtkTkRenderWidget"
</p>
<p>ERROR: In C:\Program Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWTkUtilities.cxx, line 221<br>vtkKWApplication (0x03414370): <br>    Script: <br>grid .1.10.18.21.22.25.100.102.104.107.108 -row 0 -column 0 -sticky nsew<br>
    Returned Error on line 1: <br>bad window path name ".1.10.18.21.22.25.100.102.104.107.108"<br>Stack trace: <br>bad window path name ".1.10.18.21.22.25.100.102.104.107.108"<br>    while executing<br>
"grid .1.10.18.21.22.25.100.102.104.107.108 -row 0 -column 0 -sticky nsew"</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>    while executing<br>"vtkTemp44 ConfigureCallback 900 668"<br>    (command bound to event)</p>
<p> Here is my code</p>
<p>//The following code includes the vtk code and the KWWidgets code for the user interface.<br>#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"
<br>#include "vtkBMPReader.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkActor.h"<br>#include "vtkActor2D.h"<br>#include "vtkImageActor.h"<br>#include "vtkOutlineFilter.h
"<br>#include "vtkCamera.h"<br>#include "vtkProperty.h"<br>#include "vtkPolyDataNormals.h"<br>#include "vtkContourFilter.h"<br>#include "vtkDataSetMapper.h"<br>#include "
vtkImageMapper.h"<br>#include "vtkVolumeMapper.h"<br>#include "vtkVolumeRayCastMapper.h"<br>#include "vtkVolumeRayCastCompositeFunction.h"<br>#include "vtkPiecewiseFunction.h"<br>
#include "vtkVolumeProperty.h"<br>#include "vtkColorTransferFunction.h"<br>#include "vtkLight.h"<br>#include "vtkFixedPointVolumeRayCastMapper.h"<br>#include "vtkKWApplication.h
"<br>#include "vtkKWWindowBase.h"<br>#include "vtkKWRenderWidget.h"<br>#include "vtkKWWindow.h"<br>#include "vtkKWFrame.h"</p>
<p>int main(int argc, char *argv[])<br>{<br> <br> // Initialize Tcl.This is required otherwise the program crashes.<br> <br> Tcl_Interp *interp = vtkKWApplication::InitializeTcl(argc, argv, &cerr);<br>  if (!interp)<br>
  {<br>  cerr << "Error: InitializeTcl failed" << endl ;<br>  return 1;<br>  }</p>
<p><br>//using bmp to read gray image<br> vtkBMPReader *reader = vtkBMPReader::New();<br> reader->SetFilePattern("%s%d.bmp");<br> <br>  reader->SetFilePrefix("C:\\Images\\PositionCReal\\Depth5mm\\slice");
<br> <br> <br> reader->SetDataExtent(0, 310, 0, 310, 1, 8);<br> reader->SetDataSpacing(1.0,1.0,20.0);<br> reader->SetDataOrigin(0.0, 0.0, 0.0);<br> reader->Update();<br> <br>  <br> //vtkImageData *finalImg = reader->GetOutput();
<br> <br>  <br> vtkPiecewiseFunction *tfun = vtkPiecewiseFunction::New();</p>
<p>//The following lines of code displays the copper target for position A and C<br> tfun->AddPoint(128,0.009);<br> tfun->AddPoint(180,1.0);<br> tfun->AddPoint(200,1.0);<br> tfun->AddPoint(255,0.0009);</p>
<p>  vtkFixedPointVolumeRayCastMapper *volumeMapper = vtkFixedPointVolumeRayCastMapper::New();<br> <br> //volumeMapper->SetSampleDistance(1.0);</p>
<p> //volumeMapper->SetInput(finalImg);<br> volumeMapper->SetInput(reader->GetOutput());</p>
<p> vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();</p>
<p>  //show gray volume<br> volumeProperty->IndependentComponentsOff();<br> volumeProperty->SetScalarOpacity(tfun);<br>  <br><br> <br> vtkVolume *newvol = vtkVolume::New();<br> newvol->SetMapper(volumeMapper);<br>
 newvol->SetProperty(volumeProperty);</p>
<p> vtkOutlineFilter *outline = vtkOutlineFilter::New();<br> outline->SetInput((vtkDataSet *) reader->GetOutput());</p>
<p> vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();<br> outlineMapper->SetInput(outline->GetOutput());</p>
<p> vtkActor *outlineActor = vtkActor::New();<br> outlineActor->SetMapper(outlineMapper);<br> outlineActor->GetProperty()->SetColor(1,1,1);</p>
<p> </p>
<p> //Create a KWWidgets Application<br> vtkKWApplication *app = vtkKWApplication::New();<br> app->SetRegistryLevel(0);<br> app->PromptBeforeExitOff();</p>
<p>   <br> vtkKWTopLevel *top = vtkKWTopLevel::New();<br> top->SetApplication(app);<br> top->Create(); <br> </p>
<p> //Add a window for the application<br> vtkKWWindow *win = vtkKWWindow::New();<br> app->AddWindow(win);<br> win->SecondaryPanelVisibilityOff();<br> win->MainPanelVisibilityOff();<br> win->Create();</p>
<p><br> vtkKWRenderWidget *renderwidget = vtkKWRenderWidget::New();<br> renderwidget->SetParent(win->GetViewFrame());<br> renderwidget->Create();<br> renderwidget->AddViewProp(newvol);<br> renderwidget->CornerAnnotationVisibilityOn();
<br> app->Script("pack %s -expand y -fill both -anchor c -expand y",renderwidget->GetWidgetName());<br> <br> win->Display();<br> app->Start();</p>
<p> <br> <br> win->Display();<br> app->Start();</p>
<p><br> return(0);</p>
<p>}<br></p>
<p>Can someone please help me out.</p>
<p>Thanks </p>
<p>Sharwari </p>
<p> </p>
<p><br> </p></div>