[Insight-users] forcing pipeline to update

Jakub Bican jakub.bican at matfyz.cz
Thu Jun 30 04:21:10 EDT 2005



Hi Karthik,

i have done some tests and here are the results (with the code). I had 
to change my classes a little bit (to use macros) and i also post a 
compilable example on which i will be explaining here.

I use the old scenario with resample filter, 
ComposeUniformTransformsTransform with 3 transforms chained. The example 
has several steps:

00) this step only prints the initial state (and "modified" values) of 
the classes - OK

01) resample filter's SetTransform methods changes the modification time 
correctly - OK

02) and if we change the transform that is already set to the filter, it 
still works - OK

03) set composed transform back to resample filter - just maintenance 
step - OK

04) change the entire container inside the composed transform - this 
works OK as i changed the composed transform to use the macros - OK

05) add a transform (PermuteAxesTransform) to the container set to 
composed transform in previous step - PROBLEM - container's 
(VectorContainer) modification time changed, but the composedtransform's 
not. (this was the same even if i used non-const pointers and macros in 
the compose transform - if it has any meaning)

06) set a new permutation to the PermuteAxesTransform from the last step 
... PROBLEMS:
- PermuteAxesTransform is modified although it does not use Set macro or 
call this->Modified() in Set method
- VectorContainer containing the PermuteAxesTransform did not get 
modified although its "member" did


So 3 questions:
1) Why the modification time of the ComposeUniformTrasformsTransform 
instance did NOT CHANGE, when there was a new item inserted into its 
transform container, which modification time was correctly changed by 
this operation?

2) Why the modification time of the PermuteAxesTransform instance 
CHANGED when a new permutation was set in it, even though it does not 
use the Set macro or call this->Modified() explicitly?

3) Why the modification time of the VectorContainer instance did NOT 
CHANGE, when the modification time of one of its members did?


I think that if we are able to answer these questions, we would fix the 
problem. But with my current knowledge, i can't see what should it be.

Thank you again very much for your attention and time that you spent 
answering my questions and solving my problems.

Cheers,
     Jakub


Karthik Krishnan napsal(a):
> You should be fine with the code... Did you see if Modified() was called 
> along the way ?..
> 
> You need to ensure in the transforms you have created that any time any 
> of the transform's ivars are changed you call this->Modified()
> 
> The Set/Get macros do this for you automatically... See Common/itkMacro.h
> 
> I do not know how you use your VectorContainer of transforms within this 
> 'ComposeUniformTransformsTransform'. Since VectorContainer is a subclass 
> of itk::Object, if its contents are modified, it should update its 
> modification time causing ComposeUniformTransformsTransform's 
> modification time to change.. but you might want to check yourself if 
> this is indeed true.
> 
> HTH
> Karthik
> 
> Jakub Bican wrote:
> 
>>
>>
>> AHA! :))
>>
>> I have my own transforms that might be doing something wrong so that 
>> resample filter is not "modified" when the transform is.
>>
>> I wrote a ComposeUniformTransformsTransform that has an array of 
>> transforms and transforms point by consecutively transforming it by 
>> transforms in the array. "Uniform" in the classname means that the 
>> transforms should preserve the Dimension (i was not able to program 
>> such class that can chain transforms with arbitrary dimensionality). 
>> The meaning of such transform is to avoid chaining several resample 
>> filters where several successive transforms are neccessary.
>>
>> In this my app, i use PolarToCartesianTransform, succeeded by 
>> PermuteAxesTransform which enables me to use polar coordinates in 
>> various orthogonal directions. These classes are composed with 
>> previous class.
>>
>> Now - i need resample filter to compute several instances of 
>> transformed image with various permutations set into 
>> PermuteAxesTransform - and there was the problem...
>>
>> I am attaching sources of mentioned classes - in following days, i 
>> will try to improve them to support "modified" features correctly. I 
>> would be grateful, if you take a look at the sources and help me with 
>> fixing this (and any other problem that you find), or even provide 
>> some information, what should i follow (in docs, examples, etc).
>>
>> I am sorry that i did not post the problem as it lays first. I wanted 
>> to sketch the situation without having obscure with too many details 
>> which i considered unimportant ;)
>>
>> Thanks,
>>     Jakub
>>
>>
> 
> 
-------------- next part --------------
00 ********************************************
VectorContainer (00279538)
  RTTI typeinfo:   class itk::VectorContainer<int,class itk::SmartPointer<class itk::Transform<double,3,3> > >
  Reference Count: 2
  Modified Time: 27
  Debug: Off
  Observers:
    none
PolarToCartesianTransform (00277E00)
  RTTI typeinfo:   class itk::PolarToCartesianTransform<double,3>
  Reference Count: 2
  Modified Time: 16
  Debug: Off
  Observers:
    none
PermuteAxesTransform (00277F68)
  RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
  Reference Count: 2
  Modified Time: 17
  Debug: Off
  Observers:
    none
  Order: [0, 1, 2]
  InverseOrder: [0, 1, 2]
Rigid3DTransform (00279120)
  RTTI typeinfo:   class itk::Rigid3DTransform<double>
  Reference Count: 2
  Modified Time: 21
  Debug: Off
  Observers:
    none
  Matrix:
    1 0 0
    0 1 0
    0 0 1
  Offset: [0, 0, 0]
  Center: [0, 0, 0]
  Translation: [0, 0, 0]
  Inverse:
    1 0 0
    0 1 0
    0 0 1
  Singular: 0
VectorContainer (00279538)
  RTTI typeinfo:   class itk::VectorContainer<int,class itk::SmartPointer<class itk::Transform<double,3,3> > >
  Reference Count: 2
  Modified Time: 27
  Debug: Off
  Observers:
    none
ComposeUniformTransformsTransform (00277B90)
  RTTI typeinfo:   class itk::ComposeUniformTransformsTransform<double,3,class itk::VectorContainer<int,class itk::Smart
Pointer<class itk::Transform<double,3,3> > > >
  Reference Count: 2
  Modified Time: 28
  Debug: Off
  Observers:
    none
  Transform "0":
    PolarToCartesianTransform (00277E00)
      RTTI typeinfo:   class itk::PolarToCartesianTransform<double,3>
      Reference Count: 2
      Modified Time: 16
      Debug: Off
      Observers:
        none
  Transform "1":
    PermuteAxesTransform (00277F68)
      RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
      Reference Count: 2
      Modified Time: 17
      Debug: Off
      Observers:
        none
      Order: [0, 1, 2]
      InverseOrder: [0, 1, 2]
  Transform "2":
    Rigid3DTransform (00279120)
      RTTI typeinfo:   class itk::Rigid3DTransform<double>
      Reference Count: 2
      Modified Time: 21
      Debug: Off
      Observers:
        none
      Matrix:
        1 0 0
        0 1 0
        0 0 1
      Offset: [0, 0, 0]
      Center: [0, 0, 0]
      Translation: [0, 0, 0]
      Inverse:
        1 0 0
        0 1 0
        0 0 1
      Singular: 0
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 30
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00277B90
  Interpolator: 00277A20
01 ********************************************
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 31
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00279120
  Interpolator: 00277A20
02 ********************************************
Rigid3DTransform (00279120)
  RTTI typeinfo:   class itk::Rigid3DTransform<double>
  Reference Count: 3
  Modified Time: 32
  Debug: Off
  Observers:
    none
  Matrix:
    1 0 0
    0 1 0
    0 0 1
  Offset: [0, 0, 0]
  Center: [1, 0, 0]
  Translation: [0, 0, 0]
  Inverse:
    1 0 0
    0 1 0
    0 0 1
  Singular: 0
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 32
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00279120
  Interpolator: 00277A20
03 ********************************************
ComposeUniformTransformsTransform (00277B90)
  RTTI typeinfo:   class itk::ComposeUniformTransformsTransform<double,3,class itk::VectorContainer<int,class itk::Smart
Pointer<class itk::Transform<double,3,3> > > >
  Reference Count: 2
  Modified Time: 28
  Debug: Off
  Observers:
    none
  Transform "0":
    PolarToCartesianTransform (00277E00)
      RTTI typeinfo:   class itk::PolarToCartesianTransform<double,3>
      Reference Count: 2
      Modified Time: 16
      Debug: Off
      Observers:
        none
  Transform "1":
    PermuteAxesTransform (00277F68)
      RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
      Reference Count: 2
      Modified Time: 17
      Debug: Off
      Observers:
        none
      Order: [0, 1, 2]
      InverseOrder: [0, 1, 2]
  Transform "2":
    Rigid3DTransform (00279120)
      RTTI typeinfo:   class itk::Rigid3DTransform<double>
      Reference Count: 2
      Modified Time: 32
      Debug: Off
      Observers:
        none
      Matrix:
        1 0 0
        0 1 0
        0 0 1
      Offset: [0, 0, 0]
      Center: [1, 0, 0]
      Translation: [0, 0, 0]
      Inverse:
        1 0 0
        0 1 0
        0 0 1
      Singular: 0
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 33
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00277B90
  Interpolator: 00277A20
04 ********************************************
VectorContainer (00277888)
  RTTI typeinfo:   class itk::VectorContainer<int,class itk::SmartPointer<class itk::Transform<double,3,3> > >
  Reference Count: 2
  Modified Time: 34
  Debug: Off
  Observers:
    none
ComposeUniformTransformsTransform (00277B90)
  RTTI typeinfo:   class itk::ComposeUniformTransformsTransform<double,3,class itk::VectorContainer<int,class itk::Smart
Pointer<class itk::Transform<double,3,3> > > >
  Reference Count: 2
  Modified Time: 35
  Debug: Off
  Observers:
    none
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 35
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00277B90
  Interpolator: 00277A20
05 ********************************************
PermuteAxesTransform (00277F68)
  RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
  Reference Count: 3
  Modified Time: 17
  Debug: Off
  Observers:
    none
  Order: [0, 1, 2]
  InverseOrder: [0, 1, 2]
VectorContainer (00277888)
  RTTI typeinfo:   class itk::VectorContainer<int,class itk::SmartPointer<class itk::Transform<double,3,3> > >
  Reference Count: 2
  Modified Time: 37
  Debug: Off
  Observers:
    none
ComposeUniformTransformsTransform (00277B90)
  RTTI typeinfo:   class itk::ComposeUniformTransformsTransform<double,3,class itk::VectorContainer<int,class itk::Smart
Pointer<class itk::Transform<double,3,3> > > >
  Reference Count: 2
  Modified Time: 35
  Debug: Off
  Observers:
    none
  Transform "0":
    PermuteAxesTransform (00277F68)
      RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
      Reference Count: 3
      Modified Time: 17
      Debug: Off
      Observers:
        none
      Order: [0, 1, 2]
      InverseOrder: [0, 1, 2]
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 35
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00277B90
  Interpolator: 00277A20
06 ********************************************
PermuteAxesTransform (00277F68)
  RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
  Reference Count: 3
  Modified Time: 38
  Debug: Off
  Observers:
    none
  Order: [1, 2, 0]
  InverseOrder: [2, 0, 1]
VectorContainer (00277888)
  RTTI typeinfo:   class itk::VectorContainer<int,class itk::SmartPointer<class itk::Transform<double,3,3> > >
  Reference Count: 2
  Modified Time: 37
  Debug: Off
  Observers:
    none
ComposeUniformTransformsTransform (00277B90)
  RTTI typeinfo:   class itk::ComposeUniformTransformsTransform<double,3,class itk::VectorContainer<int,class itk::Smart
Pointer<class itk::Transform<double,3,3> > > >
  Reference Count: 2
  Modified Time: 35
  Debug: Off
  Observers:
    none
  Transform "0":
    PermuteAxesTransform (00277F68)
      RTTI typeinfo:   class itk::PermuteAxesTransform<double,3>
      Reference Count: 3
      Modified Time: 38
      Debug: Off
      Observers:
        none
      Order: [1, 2, 0]
      InverseOrder: [2, 0, 1]
ResampleImageFilter (002754C0)
  RTTI typeinfo:   class itk::ResampleImageFilter<class itk::Image<float,3>,class itk::Image<float,3>,double>
  Reference Count: 1
  Modified Time: 35
  Debug: Off
  Observers:
    none
  Number Of Required Inputs: 1
  Number Of Required Outputs: 1
  Number Of Threads: 1
  ReleaseDataFlag: Off
  ReleaseDataBeforeUpdateFlag: Off
  No Inputs
  Output 0: (002774C8)
  AbortGenerateData: Off
  Progress: 0
  Multithreader:
    RTTI typeinfo:   class itk::MultiThreader
    Reference Count: 1
    Modified Time: 2
    Debug: Off
    Observers:
      none
    Thread Count: 1
    Global Maximum Number Of Threads: 0
  DefaultPixelValue: 0
  Size: [0, 0, 0]
  OutputStartIndex: [0, 0, 0]
  OutputSpacing: [1, 1, 1]
  OutputOrigin: [0, 0, 0]
  Transform: 00277B90
  Interpolator: 00277A20
07 ********************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: src.zip
Type: application/x-zip-compressed
Size: 11492 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050630/192cbac3/src-0001.bin


More information about the Insight-users mailing list