[vtkusers] QVTKWidget + volume misbehavior
Dominik Szczerba
dominik at itis.ethz.ch
Wed Nov 12 16:01:53 EST 2008
I found a way, but if it is a way out or around, I am not sure.
vtkInformation* info = image->GetPipelineInformation();
info->Set(vtkDataObject::SPACING(), spc, 3);
When this is called right after imate->Modified() then I get the right
spacing after Render().
Because my image is not a part of any pipeline (just a DeepCopy of a
reader's GetOutput) I did not expect to need to modify the pipeline. I
successfuly apply the same philosophy to grids. What's the difference?
with regards,
Dominik
Dominik Szczerba wrote:
> I traced the problem down to vtkOpenGLRenderer (being called by
> Render()). It is calling this->UpdateGeometry() which in turn sets my
> image's spacing (to the old one!).
>
> 1) Why should rendering change the rendered object?
> 2) Am I not missing something more than image->Modified() here? I tried
> UpdateInformation() etc. manually with the same result: resetting the
> spacing to an old (wrong) one.
>
> I believe this is a bug, am just wondering how to pose it for a most
> efficient fix.
>
> Dominik
>
> Dominik Szczerba wrote:
>> I am doing something as trivial as:
>>
>> // record existing spacing
>> image->GetSpacing(old_spacing);
>>
>> // modify it
>> image->SetSpacing(new_spacing);
>> image->Modified();
>>
>> // refresh display
>> vtkWidget->GetRenderWindow()->Render();
>>
>> // debug
>> image->GetSpacing(current_spacing);
>>
>>
>> which behaves correctly, with current_spacing = new_spacing and my
>> outline actor responding to the changes.
>>
>> The moment I call:
>>
>> ren1->AddVolume(volume); // volume is representation of image
>>
>> I can properly see my volume only before calling Render():
>> current_spacing gets reset back to old_spacing right after.
>>
>> 1) Am I doing something obviously wrong (like I am not allowed to
>> modify a registered volume)
>> 2) What is caching the original image properties and why?
>>
>> Thanks for any hints,
>> Dominik
>>
>
--
Dominik Szczerba, PhD
Computational Physics Group
IT'IS Foundation
http://www.itis.ethz.ch
More information about the vtkusers
mailing list