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 <[email protected]>

> 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 <[email protected]>:
>>>
>>>> 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
>>>> [email protected]
>>>> 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
> -------------------------------------------------
>
<ServerManagerConfiguration>
   <ProxyGroup name="sources">
      <!-- ================================================================== -->
      <SourceProxy name="ImageGaussianSource"
                   class="vtkImageGaussianSource"
                   label="Gaussian Source">
         <Documentation
                       long_help="Outputs an image with gaussian values."
                       short_help="Outputs an image with gaussian values.">
         </Documentation>
         
         <IntVectorProperty
                           name="WholeExtent"
                           label="WholeExtent"
                           number_of_elements="6"
                           command="SetWholeExtent"
                           default_values="0 127 0 127 0 127" >
            <Documentation>
            </Documentation>
         </IntVectorProperty>
         
         <DoubleVectorProperty
                              name="Center"
                              label="Center"
                              number_of_elements="3"
                              command="SetCenter"
                              default_values="63 63 63" >
            <Documentation>
            </Documentation>
         </DoubleVectorProperty>
         
         <DoubleVectorProperty
                              name="Maximum"
                              label="Maximum"
                              number_of_elements="1"
                              command="SetMaximum"
                              default_values="1" >
            <Documentation>
            </Documentation>
         </DoubleVectorProperty>
         
         <DoubleVectorProperty
                              name="StandardDeviation"
                              label="StandardDeviation"
                              number_of_elements="1"
                              command="SetStandardDeviation"
                              default_values="3" >
            <Documentation>
            </Documentation>
         </DoubleVectorProperty>
      </SourceProxy>
      <!-- End ImageGaussianSource -->
   </ProxyGroup>
   <!-- End Sources Group -->
   
   <ProxyGroup name="filters">      
      <!-- ================================================================== -->
      <SourceProxy name="ImageMagnitude" class="vtkImageMagnitude" label="Image Magnitude">
         <Documentation
                       long_help="Collapse image components."
                       short_help="vtkImageMagnitude filter.">
         </Documentation>
         
         <InputProperty
                       name="Input"
                       command="SetInputConnection">
            <ProxyGroupDomain name="groups">
               <Group name="sources"/>
               <Group name="filters"/>
            </ProxyGroupDomain>
            <DataTypeDomain name="input_type">
               <DataType value="vtkImageData"/>
            </DataTypeDomain>
         </InputProperty>
      </SourceProxy>
      <!-- End ImageMagnitude -->
      
      <!-- ================================================================== -->
      <SourceProxy name="ImageResample"
                   class="vtkImageResample"
                   label="Image Resample">
         <Documentation
                       long_help="Resample Image."
                       short_help="vtkImageResample filter.">
         </Documentation>
         <InputProperty
                       name="Input"
                       command="SetInputConnection">
            <ProxyGroupDomain name="groups">
               <Group name="sources"/>
               <Group name="filters"/>
            </ProxyGroupDomain>
            <DataTypeDomain name="input_type">
               <DataType value="vtkDataSet"/>
            </DataTypeDomain>
         </InputProperty>

        <DoubleVectorProperty
                          name="AxisOutputSpacing"
                           label="AxisOutputSpacing"
                           command="SetAxisOutputSpacing"
                           number_of_elements="3"
                           number_of_elements_per_command="1"
                           use_index="1"
                           repeat_command="1"
                           animateable="1"
                           default_values="1 1 1" >
            <Documentation>
               Choose the component to extract.
            </Documentation>
         </DoubleVectorProperty>
        <DoubleVectorProperty
                          name="AxisMagnificationFactor"
                           label="AxisMagnificationFactor"
                           command="SetAxisMagnificationFactor"
                           number_of_elements="3"
                           number_of_elements_per_command="1"
                           use_index="1"
                           repeat_command="1"
                           animateable="1"
                           default_values="1 1 1" >
            <Documentation>
               Choose the components to extract.
            </Documentation>
         </DoubleVectorProperty>
        <IntVectorProperty
                           name="InterpolationMode"
                           command="SetInterpolationMode"
                           number_of_elements="1"
                           default_values="2"
                           animateable="0">
          <EnumerationDomain name="enum">
            <Entry value="0" text="NearestNeighbor"/>
            <Entry value="1" text="Linear"/>
            <Entry value="2" text="Cubic"/>
          </EnumerationDomain>

          <Documentation>

          </Documentation>
        </IntVectorProperty>
        <IntVectorProperty
                             name="Interpolate"
                             command="SetInterpolate"
                             number_of_elements="1"
                             default_values="1"
                             animateable="0">
          <BooleanDomain name="boolean"/>
          <Documentation>

          </Documentation>
        </IntVectorProperty>        
     </SourceProxy>
      <!-- End ImageResample -->      
   </ProxyGroup>
   <!-- End Filters Group -->
</ServerManagerConfiguration>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to