[Insight-developers] RE: DisconnectSource calls Modified()
Miller, James V (Research)
millerjv at crd.ge.com
Tue Aug 17 09:18:42 EDT 2004
Julien,
The output needs to know that ProcessObject was disconnected because
of the pipeline mechanics. An call to Update() on a ProcessObject
yields a call to Update() on each of its inputs. A call to Update()
on each on the inputs, yields a call to Update() on each input's source
(a ProcessObject). A call to Update() on each source, yields a call to
Update() on each input to source, etc.
So a DataObject has to know who its source is in order to propagate the
pipeline information up the pipeline. Remember, pipeline objects are
not connected directly together. Inbetween two pipeline objects sits
a DataObject.
So when your reader goes out of scope, the source for the output
DataObject is being destroyed and that DataObject needs to know that
so that it does not try to propagate pipeline calls up to a non-existent
pipeline.
We mark the DataObject as being modified because in essence, it has
been modified. Its behavior in the pipeline is now different than
it was prior to the reader being deleted. You could argue that
the modification is "inconsequential" since it did not modify any of
the pixel data. However, I could probably come up with a set of calls
where the various portions of the pipeline were created/destroyed/updated
in such an order that if we did not mark the DataObject as being modified
when its source was disconnected that the pipeline would not behave
correctly.
Jim
-----Original Message-----
From: Julien Jomier [mailto:jjomier at cs.unc.edu]
Sent: Monday, August 16, 2004 11:08 PM
To: 'Miller, James V (Research)'
Cc: 'Insight Developers'
Subject: DisconnectSource calls Modified()
Jim, pipeline gurus,
I noticed some strange behavior while running this code:
[snip]
{
typedef itk::ImageFileReader<Image3DType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(IMAGEPATH);
imageReader->Update();
m_Image3D = imageReader->GetOutput();
std::cout << m_Image3D->GetMTime() << std::endl;
}
std::cout << m_Image3D->GetMTime() << std::endl;
[snip]
The two GetMTime() returned are different. Looking at the DataObject class I
found that DataObject::DisconnectSource() calls this->Modified(). Therefore
when the imageReader is destroyed the m_Image3D modified time is updated. Is
this an expected behavior? why does the output needs to know that the
process object has been disconnected?
Sorry if this is a naive question,
Julien
More information about the Insight-developers
mailing list