[Insight-users] question regarding QT - ITK connection

Sergio Aguirre sergio.aguirre at gmail.com
Mon Jul 13 20:47:11 EDT 2009


Hello everyone.

I have been slowly getting the hang of QT and ITK, After a few days I
successfully was able to compile and run the QTITK example located at
http://public.kitware.com/cgi-bin/viewcvs.cgi/QtITK/?root=InsightApplications

The small app loads and image and shows colors depending of the progress it
takes when going through a filter. Also it displays a progress bar. I am
using 'curvatureflowimagefilter' to test the connections.

I now would like to use a slider to set the SetNumberofIterations int
variable of the filter from the GUI. Unfortunately I get the message below.

I believe I am close as I was able to start the filter using the QTSlider -
sliderMoved function to trigger the file reading and filtering by calling
the Update function.

Any suggestions would be handy. Full code is attached and code snippet is
below.

Thank you

Sergio


  QWidget qb;
  qb.resize(620,200);

  const int buttonHeight =  30;
  const int buttonWidth  = 100;
  const int buttonSpace  = 100;

  int horizontalPosition =  60;

  QPushButton  bb( "Start", &qb );
  bb.setGeometry( horizontalPosition, 20, buttonWidth, buttonHeight );

  horizontalPosition += buttonWidth + buttonSpace;

  QtLightIndicator  cc( &qb, "State" );
  cc.setGeometry( horizontalPosition, 20, buttonWidth, buttonHeight );
  cc.Modified();

  horizontalPosition += buttonWidth + buttonSpace;

  QPushButton  qt( "Quit", &qb );
  qt.setGeometry( horizontalPosition, 20, buttonWidth, buttonHeight );

  QtProgressBar qs( &qb, "Progress");
  qs.setGeometry( 10, 60, 600, 30 );

  QSlider sl(Qt::Horizontal, &qb);
  sl.setRange(1, 100);
  sl.setValue(10);
  sl.setGeometry(100, 110, 400, 60);

  // Connect the progress bar to the ITK processObject
  qs.Observe( filter.GetPointer() );
  qs.Observe( reader.GetPointer() );


  typedef QtSlotAdaptor<FilterType> SlotAdaptorType;
  SlotAdaptorType slotAdaptor1;
  // Connect the adaptor to a method of the ITK filter
  slotAdaptor1.SetCallbackFunction( filter, & FilterType::Update );
  // Connect the adaptor's Slot to the Qt Widget Signal
  QObject::connect( &bb, SIGNAL(clicked()), &slotAdaptor1, SLOT(Slot()) );

  typedef QtSlotAdaptor<FilterType> SlotAdaptorType;
  SlotAdaptorType slotAdaptor2;
  // Connect the adaptor to a method of the ITK filter
  slotAdaptor2.SetCallbackFunction( filter, &
FilterType::SetNumberOfIterations );
  // Connect the adaptor's Slot to the Qt Widget Signal
  QObject::connect( &sl, SIGNAL(sliderMoved(int)), &slotAdaptor2,
SLOT(Slot()) );


********************* COMPILE OUTPUT
*********************************************

linux-vk5n:/home/echopixel/Desktop/engine/code/epx01 # make
[ 25%] Building CXX object CMakeFiles/epx01.dir/epx.cxx.o
/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx: In function ‘int
main(int, char**)’:
/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx:81: warning:
deprecated conversion from string constant to ‘char*’
/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx:90: warning:
deprecated conversion from string constant to ‘char*’
/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx:113: error: no
matching function forcall to
‘QtSlotAdaptor<itk::CurvatureFlowImageFilter<itk::Image<float, 2u>,
itk::Image<float, 2u> >
>::SetCallbackFunction(itk::SmartPointer<itk::CurvatureFlowImageFilter<itk::Image<float,
2u>, itk::Image<float, 2u> > >&, void
(itk::FiniteDifferenceImageFilter<itk::Image<float, 2u>, itk::Image<float,
2u> >::*)(unsigned int))’
/home/echopixel/Desktop/engine/code/epx01/src/itkQtAdaptor.h:67: note:
candidates are: void QtSlotAdaptor<T>::SetCallbackFunction(T*, void
(T::*)()) [with T = itk::CurvatureFlowImageFilter<itk::Image<float, 2u>,
itk::Image<float, 2u> >]
/home/echopixel/Desktop/engine/code/epx01/src/itkQtAdaptor.h:76:
note:                 void QtSlotAdaptor<T>::SetCallbackFunction(T*, void
(T::*)(int)) [with T = itk::CurvatureFlowImageFilter<itk::Image<float, 2u>,
itk::Image<float, 2u> >]
/home/echopixel/Desktop/engine/code/epx01/src/itkQtAdaptor.h:85:
note:                 void QtSlotAdaptor<T>::SetCallbackFunction(T*, void
(T::*)(double)) [with T = itk::CurvatureFlowImageFilter<itk::Image<float,
2u>, itk::Image<float, 2u> >]
make[2]: *** [CMakeFiles/epx01.dir/epx.cxx.o] Error 1
make[1]: *** [CMakeFiles/epx01.dir/all] Error 2
make: *** [all] Error 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090713/43664b53/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtitk.zip
Type: application/zip
Size: 11288 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090713/43664b53/attachment-0001.zip>


More information about the Insight-users mailing list