<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Le 07/07/2010 20:09, Karthik Krishnan a écrit :
<blockquote
cite="mid:AANLkTilQGy1MSGBLU0l6T2oZLarNmj3IKBEVLsmfP8Lv@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Wed, Jul 7, 2010 at 2:56 PM, Cyrille
Faucheux <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:cyrille.faucheux@etu.univ-tours.fr">cyrille.faucheux@etu.univ-tours.fr</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;"><br>
Creating and connecting all these objects seems to be the proper way to
build the pipeline in order to display an image, but recreating and
reconnecting everything seems wrong to me when I want to open another
image.<br>
<br>
Can somebody confirm if it's the proper way or if there is better/more
efficient way to achieve this ?<br>
</blockquote>
<div><br>
If you've set things up correctly, there should be no need to reconnect
everything again. The pipeline will ensure that an update of the output
(or render) will account for any changes in the input at any stage of
the pipeline.<br>
</div>
</div>
</blockquote>
Ok, so now I'm creating my vtkImageViewer and connecting it to my
QVTKWidget once in the constructor of my class (which is connected to
the GUI).<br>
<br>
Then, in the method in charge of opening a new image, I still have to
create my itk::ImageReader and my itk::ImageToVTKImageFilter, connect
them and link it to the vtkImageViewer in order to get everything
working.<br>
<br>
I've tried several conbinations of creating and connecting the whole
pipeline in my constructor and just calling the SetFilename method of
my reader in the function in charge of opening a new image, but all I
get is either an exception, a black window, or no change at all.<br>
<br>
An example I have is ${VTK-5.4.2_SRC}\Examples\GUI\Qt\SimpleView, but
it always load the same data, so maybe it hides some unwanted
behaviours I want to avoid.<br>
<br>
<blockquote
cite="mid:AANLkTilQGy1MSGBLU0l6T2oZLarNmj3IKBEVLsmfP8Lv@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div><br>
</div>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I've a second question concerning the proper way to destroy the
pipeline.<br>
Right now, everything is automatically deleted since I use smart
pointers. But again, it seems wrong to me to let the application decide
about the order of deletion of these objects since they are all
connected.<br>
</blockquote>
<div><br>
Why is this of concern ? You can always force smart pointers to go out
of scope by setting the smart pointer to NULL at any point.<br>
<br>
</div>
</div>
</blockquote>
For example, if a filter is destroyed before the renderer, will the
renderer be in an "broken" state until it is deleted ?<br>
<br>
<blockquote
cite="mid:AANLkTilQGy1MSGBLU0l6T2oZLarNmj3IKBEVLsmfP8Lv@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Is it necessary to first "dismantle" the pipeline ?<br>
</blockquote>
<div><br>
I'm not sure what you understand by "dismantle" a pipeline. If you mean
disconnect a data-object from the pipeline, its done in VTK via a
shallow copy. For instance :<br>
<br>
vtkPolyData *disconnectedPoly = vtkPolyData::New(0;<br>
filter->Update() ;<br>
disconnectedPoly->ShallowCopy(filter->GetOutput());<br>
<br>
</div>
</div>
</blockquote>
Yes, that's what I meant.<br>
But not in order to get a disconnected copy, in order to leave the
pipeline in a "static" state.<br>
<br>
<blockquote
cite="mid:AANLkTilQGy1MSGBLU0l6T2oZLarNmj3IKBEVLsmfP8Lv@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div>Similarly in ITK, you would use the method "DisconnectPipeline"
on an itk::DataObject. For instance :<br>
<br>
filter->Update();<br>
itk::DataObject::Pointer dataObject = filter->GetOutput();<br>
dataObject->DisconnectPipeline();<br>
<br>
</div>
</div>
</blockquote>
</body>
</html>