Luis <br><br>Thank you! Just as a note, I modified the following lines as well... <br><br>Line 60<br> m_MemberFunctionUnsignedInt(0),<br><br>Lines 98-105<br> /** Slot to be connected to Qt Signals. */<br>
void Slot(int value) <br> {<br> if( m_MemberFunctionUnsignedInt ) <br> {<br> ((*m_This).*(m_MemberFunctionUnsignedInt))(value);<br> }<br> }<br><br>It works great now, <br><br>Sergio <br><br><div class="gmail_quote">
On Tue, Jul 14, 2009 at 9:41 AM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Sergio,<br><br><br>As the error message states:<br><br><br>The QtSlotAdaptor classs has no definition available for <br>a SetCallbackFunction() where the function takes "unsigned int"<br> as an argument.<br><br>
<br>The current options are: <br><br> void, int, and double<br><br>See lines 50-57 in itkQtAdaptor.h:<br><br>class QtSlotAdaptor : public QtTranslator<br>{<br> typedef void (T::*TMemberFunctionVoidPointer)(); <br>
typedef void (T::*TMemberFunctionIntPointer)(int); <br> typedef void (T::*TMemberFunctionDoublePointer)(double); <br><br><br>You need to insert <br><br> typedef void (T::*TMemberFunctionUnsignedIntPointer)(unsigned int); <br>
<br>in line 55,<br><br>and then insert<br><br><br> /** Specify the callback function. */<br> void SetCallbackFunction(T* object, <br> TMemberFunctionUnsignedIntPointer memberFunction)<br> {<br>
m_This = object;<br> m_MemberFunctionUnsignedInt = memberFunction;<br> }<br><br>in line 72,<br><br>and then insert<br><br> TMemberFunctionUnsignedIntPointer m_MemberFunctionUnsignedInt;<br><br>in lines 121.<br>
<br><br>NOTE, all the lines number are given *before* insertions.<br><br><br><br> Regards,<br><br><br> Luis<br><br><br>------------------------------------------------------------------------------<br><div class="gmail_quote">
<div><div></div><div class="h5">
On Mon, Jul 13, 2009 at 8:47 PM, Sergio Aguirre <span dir="ltr"><<a href="mailto:sergio.aguirre@gmail.com" target="_blank">sergio.aguirre@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">
Hello everyone. <br><br>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 <a href="http://public.kitware.com/cgi-bin/viewcvs.cgi/QtITK/?root=InsightApplications" target="_blank">http://public.kitware.com/cgi-bin/viewcvs.cgi/QtITK/?root=InsightApplications</a><br>
<br>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. <br>
<br>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. <br><br>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. <br>
<br>Any suggestions would be handy. Full code is attached and code snippet is below. <br><br>Thank you<br><br>Sergio <br><br><br> QWidget qb;<br> qb.resize(620,200);<br><br> const int buttonHeight = 30;<br> const int buttonWidth = 100;<br>
const int buttonSpace = 100;<br><br> int horizontalPosition = 60;<br><br> QPushButton bb( "Start", &qb );<br> bb.setGeometry( horizontalPosition, 20, buttonWidth, buttonHeight );<br><br> horizontalPosition += buttonWidth + buttonSpace;<br>
<br> QtLightIndicator cc( &qb, "State" );<br> cc.setGeometry( horizontalPosition, 20, buttonWidth, buttonHeight );<br> cc.Modified();<br><br> horizontalPosition += buttonWidth + buttonSpace;<br><br> QPushButton qt( "Quit", &qb );<br>
qt.setGeometry( horizontalPosition, 20, buttonWidth, buttonHeight );<br><br> QtProgressBar qs( &qb, "Progress");<br> qs.setGeometry( 10, 60, 600, 30 );<br> <br> QSlider sl(Qt::Horizontal, &qb);<br>
sl.setRange(1, 100);<br> sl.setValue(10);<br> sl.setGeometry(100, 110, 400, 60);<br><br> // Connect the progress bar to the ITK processObject<br> qs.Observe( filter.GetPointer() );<br> qs.Observe( reader.GetPointer() );<br>
<br><br> typedef QtSlotAdaptor<FilterType> SlotAdaptorType;<br> SlotAdaptorType slotAdaptor1;<br> // Connect the adaptor to a method of the ITK filter<br> slotAdaptor1.SetCallbackFunction( filter, & FilterType::Update );<br>
// Connect the adaptor's Slot to the Qt Widget Signal<br> QObject::connect( &bb, SIGNAL(clicked()), &slotAdaptor1, SLOT(Slot()) );<br><br> typedef QtSlotAdaptor<FilterType> SlotAdaptorType;<br> SlotAdaptorType slotAdaptor2;<br>
// Connect the adaptor to a method of the ITK filter<br> slotAdaptor2.SetCallbackFunction( filter, & FilterType::SetNumberOfIterations );<br> // Connect the adaptor's Slot to the Qt Widget Signal<br> QObject::connect( &sl, SIGNAL(sliderMoved(int)), &slotAdaptor2, SLOT(Slot()) );<br>
<br><br>********************* COMPILE OUTPUT *********************************************<br><br>linux-vk5n:/home/echopixel/<div>Desktop/engine/code/epx01 # make<br>[ 25%] Building CXX object CMakeFiles/epx01.dir/epx.cxx.o<br>
/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx: In function ‘int main(int, char**)’:<br>/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx:81: warning: deprecated conversion from string constant to ‘char*’<br>
/home/echopixel/Desktop/engine/code/epx01/src/epx.cxx:90: warning: deprecated conversion from string constant to ‘char*’<br>/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))’<br>
/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> >]<br>
/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> >]<br>
/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> >]<br>
make[2]: *** [CMakeFiles/epx01.dir/epx.cxx.o] Error 1<br>make[1]: *** [CMakeFiles/epx01.dir/all] Error 2<br>make: *** [all] Error 2</div><br>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br>