[vtk-developers] Hi all, I'm trying to use the progress event from a vtkDICOMImageReader to change the status ( percent ) on a QProgressBar widget. I was readed the Examples/GUI/Qt, and based on this, StartEvent and EndEvent are working fine to me by using the follow

Wagner Sales wsales at gmail.com
Thu May 4 13:15:50 EDT 2006


Hi VTK Developers,

I was posted this message at vtk-users, but unfortunatelly, no answer
was sended back.
Then, i'm posting here and put more two considerations:
1 - I suggest to include an example about this topic in future vtk
releases ( Examples/GUI/Qt/Events ).
2 - I was tried just with the vtkDICOMImageReader, not with others
filters. In ITK this problem only occurs with readers, but I was gived
the desired behaviour with others filters (e.g segmentation filters).
May be in VTK are the same?

Since I'm using Qt, i'm familiar with the slot/connection facilty, but
not so familiar with the add observer pattern, just by I was readed in
vtk books.

Thks a lot by any suggestions, example...

Wagner sales

--- POSTED MESSAGE:
Hi all,

I'm trying to use the progress event from a vtkDICOMImageReader to
change the status ( percent ) on a QProgressBar widget.
I was readed the Examples/GUI/Qt, and based on this, StartEvent and
EndEvent are working fine to me by using the following code:

   // my connections, based on vtkEventQtSlotConnect
    m_connector->Connect( m_dicomReader, vtkCommand::EndEvent, this,
SLOT(slotEnded(vtkObject*)));
    m_connector->Connect( m_dicomReader, vtkCommand::StartEvent, this,
SLOT(slotStarted(vtkObject*)));
   // my slots:
void MyWidget::slotStarted(vtkObject* obj)
{
    std::cout << "---> Dicom reader started!" << endl;
}
void MyWidget::slotEnded(vtkObject* obj)
{
     std::cout << "---> Dicom reader ended!" << endl;
}

Well, before to set my QProgressBar progress I was just put some output
to std::cout ( code are at the end ).
Then, I'm trying to do the same with the ProgressEvent, but only one
time are showed to me the message:
-- Progress: 0
-- Progress Text:

Someone have some help or example how to use?
The code to understand are here:

//connection
m_connector->Connect( m_dicomReader, vtkCommand::ProgressEvent, this,
SLOT(slotProgressChanged(vtkObject*)));

//slot
void MyWidget::slotProgressChanged(vtkObject* obj)
{
    vtkDICOMImageReader *r = vtkDICOMImageReader::SafeDownCast(obj);
    std::cout << "-- Progress: " << r->GetProgress() << endl;
    std::cout << "-- Progress text: " << r->GetProgressText() << endl;
}

Thnks in advance,

Wagner Sales
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20060504/fde2c1c2/attachment.html>


More information about the vtk-developers mailing list