[vtkusers] Problem with creating a UI using KWWidgets
Sharwari Mavalankar
sharwari at gmail.com
Tue Oct 17 21:52:55 EDT 2006
hi Ashish,
What exactly was the error?
Sharwari
On 10/17/06, Ashish Singh <mrasingh at gmail.com> wrote:
>
> Hi Sharwari,
>
> I have these variables set to ON. I have already build vtk and kwwidgets
> with TCL,TK options set to ON and tested it with examples. They run fine.
>
> I think I didnt put the question correctly. What I was asking was how does
> the cmakelist.txt file look like for the code you posted here. I am making
> a GUI for my dicom volume rendering based on the code you posted and when I
> build this GUI code that gives me linker error. So I was thinking that maybe
> I am doing something wrong there. Can you please tell me how the
> cmaklist.txt file look like for kwwidget GUI code?
>
>
> Thanks,
> Ashish
>
> On 10/17/06, Sharwari Mavalankar < sharwari at gmail.com> wrote:
> >
> > hi Ashish,
> > The cmake file (for vtk) should have the following two variables set to
> > ON.
> > VTK_USE_TK and
> > VTK_WRAP_TCL
> > So try and build vtk again using these two cmake variables to ON and
> > then build KWWidgets again.
> > Let me know if it helps.
> > Thanks
> > Sharwari
> >
> >
> >
> > On 10/17/06, Ashish Singh <mrasingh at gmail.com > wrote:
> > >
> > > Hi Sharwari, I am getting a linker error for my dicom volume GUI code
> > > (using KWWidgets) which is exactly similar to ur code above. I am not sure
> > > if my cmakelist file is right. Can you plz. tell me what goes in the
> > > cmakelist file?
> > >
> > > Thanks,
> > > Ashish
> > >
> > > On 10/17/06, Ashish Singh <mrasingh at gmail.com > wrote:
> > > >
> > > > Hi Sharwari,
> > > > How does the cmake file for your code look like? What all things
> > > > need to go in the cmake file? is there an example you are following?
> > > > So soes your volume finally show up ?
> > > > I got Qt working with VTK but am stuck again with transfering data
> > > > between Qt and vtk.
> > > >
> > > > Thanks,
> > > > Ashish
> > > >
> > > >
> > > > On 10/17/06, Amy Squillacote < amy.squillacote at kitware.com > wrote:
> > > > >
> > > > > Hi Sharwari,
> > > > >
> > > > > I'm copying this back to the vtkusers list so other people can see
> > > > > the resolution of your problem.
> > > > >
> > > > > - Amy
> > > > >
> > > > > Sharwari Mavalankar wrote:
> > > > >
> > > > > hi Amy,
> > > > > Thanks for your email.
> > > > > yes I have turned both the CMAKE variables to bool value =ON.
> > > > > But I realized that there were some .dll and .lib files that had
> > > > > to be updated.
> > > > > I did that and now that error is gone.
> > > > > but thanks anyways!
> > > > > Sharwari
> > > > >
> > > > > On 10/17/06, Amy Squillacote < amy.squillacote at kitware.com> wrote:
> > > > >
> > > > > > Hi Sharwari,
> > > > > >
> > > > > > In the VTK that you're using with KWWidgets, did you turn on
> > > > > > both of the following CMake variables: VTK_USE_RENDERING and VTK_WRAP_TCL?
> > > > > > Both of them are required in order for vtkTkRenderWidget to be built.
> > > > > >
> > > > > > - Amy
> > > > > >
> > > > > > Sharwari Mavalankar wrote:
> > > > > >
> > > > > > hi all,
> > > > > > I am working on creating a UI using KWWidgets.
> > > > > > I want to display a 3D volume in this UI from 2D BMP slices.
> > > > > > The volume rendering is working fine without the UI.But I seem
> > > > > > to have some problem with the UI.
> > > > > > It displays the UI window, but I cannot see the 3D volume inside
> > > > > > it.
> > > > > > Addionally on running the program I get the following error on
> > > > > > the vtkoutput window.
> > > > > >
> > > > > > ERROR: In C:\Program
> > > > > > Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWTkUtilities.cxx, line 221
> > > > > > vtkKWApplication (0x03414370):
> > > > > > Script:
> > > > > > vtkTkRenderWidget .1.10.18.21.22.25.100.102.104.107.108 -rw
> > > > > > Addr=03428710
> > > > > > Returned Error on line 1:
> > > > > > invalid command name "vtkTkRenderWidget"
> > > > > > Stack trace:
> > > > > > invalid command name "vtkTkRenderWidget"
> > > > > > while executing
> > > > > > "vtkTkRenderWidget .1.10.18.21.22.25.100.102.104.107.108 -rw
> > > > > > Addr=03428710"
> > > > > >
> > > > > >
> > > > > > ERROR: In C:\Program
> > > > > > Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWWidget.cxx, line 301
> > > > > > vtkKWCoreWidget (0x03428990): Error creating the widget
> > > > > > .1.10.18.21.22.25.100.102.104.107.108 of type vtkTkRenderWidget: invalid
> > > > > > command name "vtkTkRenderWidget"
> > > > > >
> > > > > > ERROR: In C:\Program
> > > > > > Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWTkUtilities.cxx, line 221
> > > > > > vtkKWApplication (0x03414370):
> > > > > > Script:
> > > > > > grid .1.10.18.21.22.25.100.102.104.107.108 -row 0 -column 0
> > > > > > -sticky nsew
> > > > > > Returned Error on line 1:
> > > > > > bad window path name ".1.10.18.21.22.25.100.102.104.107.108"
> > > > > > Stack trace:
> > > > > > bad window path name ".1.10.18.21.22.25.100.102.104.107.108"
> > > > > > while executing
> > > > > > "grid .1.10.18.21.22.25.100.102.104.107.108 -row 0 -column 0
> > > > > > -sticky nsew"
> > > > > >
> > > > > >
> > > > > > ERROR: In C:\Program
> > > > > > Files\KWWidgets\KWWidgets-HEAD-cvs\vtkKWApplication.cxx, line 999
> > > > > > vtkKWApplication (0x03414370): TclTk error: Object named:
> > > > > > vtkTemp44, could not find requested method: ConfigureCallback
> > > > > > or the method was called with incorrect arguments.
> > > > > >
> > > > > > Object named: vtkTemp44, could not find requested method:
> > > > > > ConfigureCallback
> > > > > > or the method was called with incorrect arguments.
> > > > > >
> > > > > > while executing
> > > > > > "vtkTemp44 ConfigureCallback 900 668"
> > > > > > (command bound to event)
> > > > > >
> > > > > > Here is my code
> > > > > >
> > > > > > //The following code includes the vtk code and the KWWidgets
> > > > > > code for the user interface.
> > > > > > #include "vtkRenderer.h"
> > > > > > #include "vtkRenderWindow.h"
> > > > > > #include "vtkRenderWindowInteractor.h"
> > > > > > #include "vtkBMPReader.h"
> > > > > > #include "vtkPolyDataMapper.h"
> > > > > > #include "vtkActor.h"
> > > > > > #include "vtkActor2D.h"
> > > > > > #include "vtkImageActor.h"
> > > > > > #include "vtkOutlineFilter.h "
> > > > > > #include "vtkCamera.h"
> > > > > > #include "vtkProperty.h"
> > > > > > #include "vtkPolyDataNormals.h"
> > > > > > #include "vtkContourFilter.h"
> > > > > > #include "vtkDataSetMapper.h"
> > > > > > #include " vtkImageMapper.h"
> > > > > > #include "vtkVolumeMapper.h"
> > > > > > #include "vtkVolumeRayCastMapper.h"
> > > > > > #include "vtkVolumeRayCastCompositeFunction.h"
> > > > > > #include "vtkPiecewiseFunction.h"
> > > > > > #include "vtkVolumeProperty.h"
> > > > > > #include "vtkColorTransferFunction.h"
> > > > > > #include "vtkLight.h"
> > > > > > #include "vtkFixedPointVolumeRayCastMapper.h"
> > > > > > #include "vtkKWApplication.h "
> > > > > > #include "vtkKWWindowBase.h"
> > > > > > #include "vtkKWRenderWidget.h"
> > > > > > #include "vtkKWWindow.h"
> > > > > > #include "vtkKWFrame.h"
> > > > > >
> > > > > > int main(int argc, char *argv[])
> > > > > > {
> > > > > >
> > > > > > // Initialize Tcl.This is required otherwise the program
> > > > > > crashes.
> > > > > >
> > > > > > Tcl_Interp *interp = vtkKWApplication::InitializeTcl(argc,
> > > > > > argv, &cerr);
> > > > > > if (!interp)
> > > > > > {
> > > > > > cerr << "Error: InitializeTcl failed" << endl ;
> > > > > > return 1;
> > > > > > }
> > > > > >
> > > > > >
> > > > > > //using bmp to read gray image
> > > > > > vtkBMPReader *reader = vtkBMPReader::New();
> > > > > > reader->SetFilePattern("%s%d.bmp");
> > > > > >
> > > > > > reader->SetFilePrefix("C:\\Images\\PositionCReal\\Depth5mm\\slice");
> > > > > >
> > > > > >
> > > > > >
> > > > > > reader->SetDataExtent(0, 310, 0, 310, 1, 8);
> > > > > > reader->SetDataSpacing(1.0,1.0,20.0);
> > > > > > reader->SetDataOrigin(0.0, 0.0, 0.0);
> > > > > > reader->Update();
> > > > > >
> > > > > >
> > > > > > //vtkImageData *finalImg = reader->GetOutput();
> > > > > >
> > > > > >
> > > > > > vtkPiecewiseFunction *tfun = vtkPiecewiseFunction::New();
> > > > > >
> > > > > > //The following lines of code displays the copper target for
> > > > > > position A and C
> > > > > > tfun->AddPoint(128,0.009);
> > > > > > tfun->AddPoint(180,1.0);
> > > > > > tfun->AddPoint(200,1.0);
> > > > > > tfun->AddPoint(255,0.0009);
> > > > > >
> > > > > > vtkFixedPointVolumeRayCastMapper *volumeMapper =
> > > > > > vtkFixedPointVolumeRayCastMapper::New();
> > > > > >
> > > > > > //volumeMapper->SetSampleDistance(1.0);
> > > > > >
> > > > > > //volumeMapper->SetInput(finalImg);
> > > > > > volumeMapper->SetInput(reader->GetOutput());
> > > > > >
> > > > > > vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
> > > > > >
> > > > > > //show gray volume
> > > > > > volumeProperty->IndependentComponentsOff();
> > > > > > volumeProperty->SetScalarOpacity(tfun);
> > > > > >
> > > > > >
> > > > > >
> > > > > > vtkVolume *newvol = vtkVolume::New();
> > > > > > newvol->SetMapper(volumeMapper);
> > > > > > newvol->SetProperty(volumeProperty);
> > > > > >
> > > > > > vtkOutlineFilter *outline = vtkOutlineFilter::New();
> > > > > > outline->SetInput((vtkDataSet *) reader->GetOutput());
> > > > > >
> > > > > > vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();
> > > > > > outlineMapper->SetInput(outline->GetOutput());
> > > > > >
> > > > > > vtkActor *outlineActor = vtkActor::New();
> > > > > > outlineActor->SetMapper(outlineMapper);
> > > > > > outlineActor->GetProperty()->SetColor(1,1,1);
> > > > > >
> > > > > >
> > > > > >
> > > > > > //Create a KWWidgets Application
> > > > > > vtkKWApplication *app = vtkKWApplication::New();
> > > > > > app->SetRegistryLevel(0);
> > > > > > app->PromptBeforeExitOff();
> > > > > >
> > > > > >
> > > > > > vtkKWTopLevel *top = vtkKWTopLevel::New();
> > > > > > top->SetApplication(app);
> > > > > > top->Create();
> > > > > >
> > > > > >
> > > > > > //Add a window for the application
> > > > > > vtkKWWindow *win = vtkKWWindow::New();
> > > > > > app->AddWindow(win);
> > > > > > win->SecondaryPanelVisibilityOff();
> > > > > > win->MainPanelVisibilityOff();
> > > > > > win->Create();
> > > > > >
> > > > > >
> > > > > > vtkKWRenderWidget *renderwidget = vtkKWRenderWidget::New();
> > > > > > renderwidget->SetParent(win->GetViewFrame());
> > > > > > renderwidget->Create();
> > > > > > renderwidget->AddViewProp(newvol);
> > > > > > renderwidget->CornerAnnotationVisibilityOn();
> > > > > > app->Script("pack %s -expand y -fill both -anchor c -expand
> > > > > > y",renderwidget->GetWidgetName());
> > > > > >
> > > > > > win->Display();
> > > > > > app->Start();
> > > > > >
> > > > > >
> > > > > >
> > > > > > win->Display();
> > > > > > app->Start();
> > > > > >
> > > > > >
> > > > > > return(0);
> > > > > >
> > > > > > }
> > > > > >
> > > > > > Can someone please help me out.
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > > Sharwari
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ------------------------------
> > > > > >
> > > > > > _______________________________________________
> > > > > > This is the private VTK discussion list.
> > > > > > Please keep messages on-topic. Check the FAQ at:
> > > > > >
> > > > > >
> > > > > >
> > > > > > http://www.vtk.org/Wiki/VTK_FAQ
> > > > > > Follow this link to subscribe/unsubscribe:http://www.vtk.org/mailman/listinfo/vtkusers
> > > > > >
> > > > > >
> > > > >
> > > > > _______________________________________________
> > > > > This is the private VTK discussion list.
> > > > > Please keep messages on-topic. Check the FAQ at:
> > > > > http://www.vtk.org/Wiki/VTK_FAQ
> > > > > Follow this link to subscribe/unsubscribe:
> > > > > http://www.vtk.org/mailman/listinfo/vtkusers
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061017/80204265/attachment.htm>
More information about the vtkusers
mailing list