[Paraview] Feature Request: vtkImageResample

Jérôme jerome.velut at gmail.com
Tue Apr 21 02:47:36 EDT 2009


Hi,

This is an up of this old thread. I have problems with vtkImageResample. I
wrote an XML that exposes this filter to ParaView, and
vtkImageGaussianSource and vtkImageMagnitude too. Please, could you try that
and tell me if you can reproduce this behaviour ?
- Load plugin as XML
- Create a Gaussian Source and Apply with default settings
- Plug an Image Resample proxy to the Gaussian Source output
- Set Spacing to 0.5 0.5 0.5
- Apply.

Then, a normal behaviour would be for ImageResample to produce a volume with
Extent twice more than input, so dimension (256, 256, 256). This is not the
case. Extent is blocked to 0 127 0 127 0 127. With the given spacing, the
bounding box is smaller than the input! You can try with a down-sampling of
the input: set Spacing to 2 2 2 in Image Resample object property panel,
Apply. Extent is twice less than input, Spacing twice more: bounding box is
the same, this behaviour is correct.

It acts like there is a saturation of the output extent according to the
input one. I didn't note that problem within a python script (outside
ParaView) and with an VTK-only dependent executable.

Find attached the XML.

Thanks for your time!
Best regards,

Jerome
WIndows XP SP3, ParaView CVS, VS2008X

2009/1/30 Bryn Lloyd <blloyd at vision.ee.ethz.ch>

> Hi again,
>
> It seems the vtkImageResample filter (and it's parent vtkImageReslice
> probably too) does not give the output array a name (unless no resampling is
> done).
>
> This would seem to be a bug. However, I couldn't follow the code in
> vtkImageReslice to see where the name could be set or what the problem is.
>
> Cheers
> Bryn
>
>
>
>
>
>
>
>
> Bryn Lloyd wrote:
>
>> Hi,
>>
>> I have tried it in a similar way with no success.
>>
>>
>> It works though using following Set-methods:
>>
>> //----------------------------------------------------------------------------
>>
>> void vtkImageResample2::SetOutputSpacing(double v[3])
>> {
>>  this->SetOutputSpacing(v[0],v[1],v[2]);
>> }
>>
>> //----------------------------------------------------------------------------
>>
>> void vtkImageResample2::SetOutputSpacing(double v0,double v1,double v2)
>> {
>>  this->SetAxisOutputSpacing(0,v0);
>>  this->SetAxisOutputSpacing(1,v1);
>>  this->SetAxisOutputSpacing(2,v2);
>> }
>>
>>
>>
>> With standard xml description:
>>
>>      <DoubleVectorProperty
>>         name="OutputSpacing"
>>         command="SetOutputSpacing"
>>         number_of_elements="3"
>>         default_values="0 0 0" >
>>      </DoubleVectorProperty>
>>
>>
>>
>> I have place the code here:
>>
>> http://www.vision.ee.ethz.ch/~blloyd/vtkImageResample2/<http://www.vision.ee.ethz.ch/%7Eblloyd/vtkImageResample2/>
>>
>>
>>
>> This seems to work (extent is changed say for MagnifactionFactos="0.5 0.5
>> 1.0"). But the image data becomes invisible. I think it converts the
>> PointData->Arrays to some other form, e.g. image scalars or something, which
>> paraview doesn't display.
>>
>>
>> --Bryn
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Jérôme wrote:
>>
>>> Hi,
>>>
>>> I tried to do what you talked about, because I need isotropic volumes
>>> for a number of algorithms. I think it is the same for you, right?
>>>
>>> I wrote an xml file that you can load in the plugin manager menu,
>>> according to this wiki page:
>>>   http://paraview.org/Wiki/Plugin_HowTo#Enabling_a_filter_in_VTK
>>>
>>> The problem is that the VTK filter seems not to be paraview-compliant:
>>> it didn't work, but unfortunately I didn't have time to describe the
>>> bugs. I joint the xml file, so that you can try and please tell me if
>>> it works for you -then I may guess it is because of my settings...-.
>>>
>>> In a nutshell, here are my problems for a volume of spacing 0.5x0.5x1
>>> that I want to be 0.5x0.5x0.5 ie magnification factor = 0.5 on axis z
>>> (= 2)
>>> - The filter updates, but the extent does not change in the output
>>> - When representation of input is 'Slice', the output dimensionality is 2
>>> !!!
>>>
>>> I hope someone could find the mistake, wherever it comes (my xml,
>>> paraview, or VTK)
>>>
>>> I also write a Cxx class that inherites from vtkImageResample and
>>> computes automatically the magnification factor depending on a
>>> user-chosen reference axis (in my example, x or y). Today, I use an
>>> independent executable that converts an input mhd file into an
>>> isotropic volume, and then I open it in paraview. I would be glad if
>>> this step is part of a paraview pipeline, but my inherited class has
>>> the same behaviour than vtkImageResample (and I think that when I
>>> tried with the parent class vtkImageReslice, the same problem
>>> occured...).
>>>
>>> Jerome
>>>
>>> 2009/1/30 Bryn Lloyd <blloyd at vision.ee.ethz.ch>:
>>>
>>>> Dear VTK Developers
>>>>
>>>>
>>>> I would like to use the vtkResampleImage class in Paraview (plugin). For
>>>> this purpose it would be helpful if in addition to the methods
>>>>
>>>> SetAxisMagnificationFactor (int axis, double factor)
>>>> SetAxisOutputSpacing (int axis, double spacing)
>>>>
>>>>
>>>> which are valid for axis 0,1 and 2, following new functions could be
>>>> added:
>>>>
>>>> SetAxisMagnificationFactor (double, double, double)
>>>> SetAxisOutputSpacing (double, double, double)
>>>>
>>>>
>>>> i.e. taking values for all three axis directions simultaneously.
>>>>
>>>>
>>>> Could this be done?
>>>>
>>>>
>>>> Thanks in advance!
>>>>
>>>> Bryn
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -------------------------------------------------
>>>> Bryn Lloyd
>>>> Computer Vision Laboratory
>>>> ETH Zürich, Sternwartstrasse 7
>>>> CH - 8092 Zürich, Switzerland
>>>> Tel: +41 44 63 26668
>>>> Fax: +41 44 63 21199
>>>> -------------------------------------------------
>>>> _______________________________________________
>>>> ParaView mailing list
>>>> ParaView at paraview.org
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>>
>>
>>
>
> --
> -------------------------------------------------
> Bryn Lloyd
> Computer Vision Laboratory
> ETH Zürich, Sternwartstrasse 7
> CH - 8092 Zürich, Switzerland
> Tel: +41 44 63 26668
> Fax: +41 44 63 21199
> -------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090421/cc771784/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExposingVTK.xml
Type: text/xml
Size: 6196 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090421/cc771784/attachment.bin>


More information about the ParaView mailing list