[vtkusers] Please help -> 2 simple examples needed

Charles Boivin Charles.Boivin at rwdiwest.com
Thu Nov 4 17:21:43 EST 2004


Hello Michnay,

I have implemented some kind of progress bar to my MFC application, so
I might be able to help you there.  I have done things a bit differently
(i.e. I have a dialog box with a progress bar in it rather than having
it in the statusbar), but you should be able to get it working in a
similar fashion.

What you want to do is to derive a class from vtkCommand and override
the Execute() member function. Here is an example...

class CProgressObserver : public vtkCommand {
public:
	static CProgressObserver* New() {
		return new CProgressObserver;
	}

	virtual void Execute(vtkObject* caller, unsigned long, void
*callData) {
		double* dProgress = (double*)(callData);
                                // set the progress using the value
stored in *dProgress
	}
};


Next, what you want to do is to "connect" a CProgressObserver instance
(in my example, pPO) to the vtk ProgressEvent. You do this using the
AddObserver() function like so:

pLengthyProcessObject->AddObserver(vtkCommand::ProgressEvent, pPO);

where pLengthProcessObject is the object you want to track the progress
of (like a vtkContourFilter object, for example), and pPO is an instance
of class CProgressObserver. Now, whenever pLengthProcessObject triggers
a ProgressEvent, pPO::Execute() will be called.

Hope this helps,

Charles

>>> Michnay Balázs <michnay at freemail.hu> 11/04/04 09:36am >>>
Dear VTK Users,
I've been trying to implement two sime things that should be pretty 
straightforward.

The first thing is about displaying progress status. My MFC application

has the progress bar in the statusbar and I can set its position by 
calling SetPos but I cannot connect it with ProgresMethod() (I don't 
know what it should be connected with).
Could you please provide a simple example how I can use my 
progressbar to indicate filter progress.
According to my VTK book ProgressMethod() has only 1 paramterer, but
it has 2... the simplest example can be very useful.

The other thing is to visualize histogram. The image is a grayscale 
image. What are the methods I must call and the properties I must set 
to get the histogram? (another simple example would be exreemely 
helpful)
I work with MSVC++ 6.

Thanks for your help,
all the best,
Balazs
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list