[vtkusers] Possibly found a bug in vtkImplicitModeller.cxx
Bill Lorensen
bill.lorensen at gmail.com
Wed Jul 11 13:12:00 EDT 2012
The reason for expressing maximum distance as a percentage(fraction) of the
bound box is to avoid specifying absolute distances.
Your patch should not be applied.
On Wed, Jul 11, 2012 at 12:59 PM, Roman Grothausmann <
roman.grothausmann at helmholtz-berlin.de> wrote:
> On 11.07.2012 17:19, Bill Lorensen wrote:
>
>> The * should remain.
>>
>
> But does that not lead to a MaximumDistance^4 in the actual calculation?
> At least that is the maximum value I find in the output if stored in 32-bit
> real.
>
>
> The value of MaximumDistance is clamped between 0 and
>> 1. You can set it to 1000000 if you want, but internally it will be set to
>> 1.0.
>>
>
> I know, that's why I changed vtkSetClampMacro(**
> MaximumDistance,double,0.0,1.**0);
> to
> vtkSetMacro(MaximumDistance,**double);
> (see patch below) and recompiled VTK. It works as I'd expect it, e.g. the
> maximum value I find in the output is very close to 10 if stored in 32-bit
> real and using SetMaximumDistance(10).
>
> -- VTK_orig/Hybrid/**vtkImplicitModeller.cxx 2012-05-12
> 13:59:27.000000000 +0200
> +++ VTK/Hybrid/**vtkImplicitModeller.cxx 2012-07-10 16:22:21.060066823
> +0200
>
> @@ -967,7 +967,7 @@
> }
> }
>
> - maxDist *= this->MaximumDistance;
> + maxDist = this->MaximumDistance;
>
> // Set volume origin and data spacing
> output->SetOrigin(this->**ModelBounds[0],
> --- VTK/Hybrid/**vtkImplicitModeller.h 2012-05-12 13:59:27.000000000
> +0200
> +++ /home/grothama/sda8/programme/**VTK/Hybrid/**vtkImplicitModeller.h
> 2012-07-11 16:27:36.203103443 +0200
> @@ -119,7 +119,8 @@
> // Description:
> // Set / get the distance away from surface of input geometry to
> // sample. Smaller values make large increases in performance.
> - vtkSetClampMacro(**MaximumDistance,double,0.0,1.**0);
> + //vtkSetClampMacro(**MaximumDistance,double,0.0,1.**0);
> + vtkSetMacro(MaximumDistance,**double);
> vtkGetMacro(MaximumDistance,**double);
>
> // Description:
>
> On Wed, Jul 11, 2012 at 10:38 AM, Roman Grothausmann <
>> roman.grothausmann at helmholtz-**berlin.de<roman.grothausmann at helmholtz-berlin.de>>
>> wrote:
>>
>> Hello!
>>>
>>> It is clamped to be between 0 and 1 but in my tests does not behave as
>>> being relative. If it were relative, it should surely not be squared.
>>> Anyway, if You remove the '*' at line 967, the output contains only
>>> values
>>> up to the absolute value specified with SetMaximumDistance.
>>> To my understanding, the value stored in MaximumDistance is used as an
>>> absolute value in the code and corresponds to the units of the input.
>>> I just tested removing the clamping and allowing any double value yields
>>> an output reaching up to 10 if SetMaximumDistance(10) is used.
>>> If You agree, I'd therefore suggest not only to remove the '*' but also
>>> the clamping in the header file.
>>>
>>> Thanks for Your comments on this
>>> Roman
>>>
>>>
>>>
>>> On 11.07.2012 14:37, Jothybasu Selvaraj wrote:
>>>
>>> If the bounds are (for simplicity) equal on all side of 5.0, then if I
>>>> set
>>>> the MaxDistacne to 0.2 ; how it will be aclculated?
>>>>
>>>> Will it be 0.5+ (0.5*0.2)=0.6?
>>>>
>>>> Thanks
>>>>
>>>> Jothy
>>>>
>>>>
>>>>
>>>> On Wed, Jul 11, 2012 at 1:35 PM, Bill Lorensen <bill.lorensen at gmail.com
>>>> >*
>>>> *wrote:
>>>>
>>>>
>>>> The bounds of the model, either computed or supplied.
>>>>
>>>>>
>>>>>
>>>>> On Wed, Jul 11, 2012 at 8:24 AM, Jothybasu Selvaraj <
>>>>> jothybasu at gmail.com
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>> "MaximumDistance is a percentage"
>>>>>
>>>>>>
>>>>>>
>>>>>> % of what?
>>>>>>
>>>>>> Jothy
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 11, 2012 at 1:10 PM, Bill Lorensen <
>>>>>> bill.lorensen at gmail.com
>>>>>>
>>>>>>> **wrote:
>>>>>>>
>>>>>>
>>>>>> MaximumDistance is clamped to be within 0 and 1.
>>>>>>
>>>>>>>
>>>>>>> On Wed, Jul 11, 2012 at 8:07 AM, Jothybasu Selvaraj <
>>>>>>> jothybasu at gmail.com
>>>>>>>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>> So, for instance what does 10.0 mean?
>>>>>>>
>>>>>>>>
>>>>>>>> Is it multiplication of the bounds of vtkPolyData?
>>>>>>>>
>>>>>>>> with bounds [-5,5,-5,5,-5,5] the operation will be applied in
>>>>>>>> [-50,50,-50,50,-50,50]
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Jothy
>>>>>>>>
>>>>>>>> On Wed, Jul 11, 2012 at 1:03 PM, Bill Lorensen <
>>>>>>>> bill.lorensen at gmail.com
>>>>>>>>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>> MaximumDistance is a percentage, not an absolute distance. The
>>>>>>>>
>>>>>>>>> documentation is not clear about this.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Jul 11, 2012 at 3:45 AM, Roman Grothausmann <
>>>>>>>>> roman.grothausmann at helmholtz-****berlin.de<roman.grothausmann@**
>>>>>>>>> helmholtz-berlin.de <roman.grothausmann at helmholtz-berlin.de>>>
>>>>>>>>>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Dear mailing list members,
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Could it be that in vtkImplicitModeller.cxx there is a bug that
>>>>>>>>>> causes the maximum distance (that is calculated and saved in the
>>>>>>>>>> image) to
>>>>>>>>>> be bigger than specified with SetMaximumDistance()?
>>>>>>>>>>
>>>>>>>>>> From the description of the filter and its parameters and also
>>>>>>>>>> from
>>>>>>>>>> the comments in the source I would expect that the output stored
>>>>>>>>>> in
>>>>>>>>>> 32-bit
>>>>>>>>>> real does not contain values above SetMaximumDistance() except for
>>>>>>>>>> the
>>>>>>>>>> "background" value.
>>>>>>>>>>
>>>>>>>>>> Having checked the source it seems to me that the squared distance
>>>>>>>>>> was always very carefully assigned to a variable name ending with
>>>>>>>>>> 2
>>>>>>>>>> (e.g.
>>>>>>>>>> maxDistance2). However at line 967 there is a *= assignment (see
>>>>>>>>>> patch
>>>>>>>>>> below). Removing the '*', the output image of the filter then
>>>>>>>>>> fulfils my
>>>>>>>>>> expectations mentioned above.
>>>>>>>>>>
>>>>>>>>>> Could the '*' be a bug?
>>>>>>>>>>
>>>>>>>>>> --- VTK_orig/Hybrid/******vtkImplicitModeller.cxx 2012-05-12
>>>>>>>>>> 13:59:27.000000000 +0200
>>>>>>>>>> +++ VTK/Hybrid/******vtkImplicitModeller.cxx 2012-07-10
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 16:22:21.060066823 +0200
>>>>>>>>>> @@ -967,7 +967,7 @@
>>>>>>>>>> }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> - maxDist *= this->MaximumDistance;
>>>>>>>>>> + maxDist = this->MaximumDistance;
>>>>>>>>>>
>>>>>>>>>> // Set volume origin and data spacing
>>>>>>>>>> output->SetOrigin(this->******ModelBounds[0],
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Happy coding
>>>>>>>>>> Roman
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Dr. Roman Grothausmann
>>>>>>>>>>
>>>>>>>>>> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
>>>>>>>>>> Bereich Funktionale Materialien
>>>>>>>>>> Institut für angewandte Materialforschung
>>>>>>>>>> Hahn-Meitner-Platz 1
>>>>>>>>>> D-14109 Berlin
>>>>>>>>>>
>>>>>>>>>> (früher Hahn-Meitner-Institut und BESSY)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Tel.: +49-(0)30-8062-42816
>>>>>>>>>> Fax.: +49-(0)30-8062-43059
>>>>>>>>>>
>>>>>>>>>> Vorsitzender des Aufsichtsrats: Prof. Dr. Dr. h.c. mult. Joachim
>>>>>>>>>> Treusch
>>>>>>>>>> Stellvertretende Vorsitzende: Dr. Beatrix Vierkorn-Rudolph
>>>>>>>>>> Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Dr. Ulrich
>>>>>>>>>> Breuer
>>>>>>>>>> Sitz der Gesellschaft: Berlin
>>>>>>>>>> Handelsregister: AG Charlottenburg, 89 HRB 5583
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ______________________________******_________________
>>>>>>>>>>
>>>>>>>>>> Powered by www.kitware.com
>>>>>>>>>>
>>>>>>>>>> Visit other Kitware open-source projects at
>>>>>>>>>> http://www.kitware.com/**
>>>>>>>>>> opensource/opensource.html<**htt**p://www.kitware.com/**
>>>>>>>>>>
>>>>>>>>>> opensource/opensource.html<htt**p://www.kitware.com/**
>>>>>>>>>> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>>>>>>>> http://www.vtk.org/Wiki/VTK_******FAQ<http://www.vtk.org/Wiki/VTK_****FAQ>
>>>>>>>>>> <http://www.vtk.org/Wiki/**VTK_**FAQ<http://www.vtk.org/Wiki/VTK_**FAQ>
>>>>>>>>>> ><
>>>>>>>>>>
>>>>>>>>>> http://www.vtk.org/Wiki/VTK_****FAQ<http://www.vtk.org/Wiki/VTK_**FAQ><
>>>>>>>>>> http://www.vtk.org/Wiki/VTK_**FAQ<http://www.vtk.org/Wiki/VTK_FAQ>
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>>>> http://www.vtk.org/mailman/******listinfo/vtkusers<http://www.vtk.org/mailman/****listinfo/vtkusers>
>>>>>>>>>> <http://www.**vtk.org/mailman/**listinfo/**vtkusers<http://www.vtk.org/mailman/**listinfo/vtkusers>
>>>>>>>>>> >
>>>>>>>>>> <http://www.**vtk.org/mailman/**listinfo/**vtkusers<http://vtk.org/mailman/listinfo/**vtkusers>
>>>>>>>>>> <http://**www.vtk.org/mailman/listinfo/**vtkusers<http://www.vtk.org/mailman/listinfo/vtkusers>
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ______________________________****_________________
>>>>>>>>> Powered by www.kitware.com
>>>>>>>>>
>>>>>>>>> Visit other Kitware open-source projects at
>>>>>>>>> http://www.kitware.com/****opensource/opensource.html<http://www.kitware.com/**opensource/opensource.html>
>>>>>>>>> <htt**p://www.kitware.com/**opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>>>>>>> http://www.vtk.org/Wiki/VTK_****FAQ<http://www.vtk.org/Wiki/VTK_**FAQ><
>>>>>>>>> http://www.vtk.org/Wiki/VTK_**FAQ<http://www.vtk.org/Wiki/VTK_FAQ>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>>> http://www.vtk.org/mailman/****listinfo/vtkusers<http://www.vtk.org/mailman/**listinfo/vtkusers>
>>>>>>>>> <http://www.**vtk.org/mailman/listinfo/**vtkusers<http://www.vtk.org/mailman/listinfo/vtkusers>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Jothybasu Selvaraj
>>>>>>>> PhD Student
>>>>>>>> University of Liverpool
>>>>>>>> UK
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> Jothybasu Selvaraj
>>>>>> PhD Student
>>>>>> University of Liverpool
>>>>>> UK
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>> Roman Grothausmann
>>>
>>> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
>>> Bereich Funktionale Materialien
>>> Institut für angewandte Materialforschung
>>> Hahn-Meitner-Platz 1
>>> D-14109 Berlin
>>>
>>> (früher Hahn-Meitner-Institut und BESSY)
>>>
>>>
>>> Tel.: +49-(0)30-8062-42816
>>> Fax.: +49-(0)30-8062-43059
>>>
>>> Vorsitzender des Aufsichtsrats: Prof. Dr. Dr. h.c. mult. Joachim Treusch
>>> Stellvertretende Vorsitzende: Dr. Beatrix Vierkorn-Rudolph
>>> Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Dr. Ulrich Breuer
>>> Sitz der Gesellschaft: Berlin
>>> Handelsregister: AG Charlottenburg, 89 HRB 5583
>>>
>>>
>>>
>>>
>>>
>>
>>
> --
> Roman Grothausmann
>
> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
> Bereich Funktionale Materialien
> Institut für angewandte Materialforschung
> Hahn-Meitner-Platz 1
> D-14109 Berlin
>
> (früher Hahn-Meitner-Institut und BESSY)
>
>
> Tel.: +49-(0)30-8062-42816
> Fax.: +49-(0)30-8062-43059
>
> Vorsitzender des Aufsichtsrats: Prof. Dr. Dr. h.c. mult. Joachim Treusch
> Stellvertretende Vorsitzende: Dr. Beatrix Vierkorn-Rudolph
> Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Dr. Ulrich Breuer
> Sitz der Gesellschaft: Berlin
> Handelsregister: AG Charlottenburg, 89 HRB 5583
>
>
>
>
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120711/7c0094b4/attachment.htm>
More information about the vtkusers
mailing list