[vtkusers] output surface coordinates for vtkSurfaceReconstructionFilter

Ismail Elkhrachy I.Elkhrachy at tu-bs.de
Tue Dec 12 03:29:07 EST 2006


Obada Mahdi wrote:
> Hello Ismail,
>
> I am sorry for the inconvenience, I have written those lines without 
> thinking
> too much about them--I probably should have presented them as 
> pseudo-code ;)
>
> On Mon, 11 Dec 2006, Ismail Elkhrachy wrote:
>>> On Thu, 7 Dec 2006, Ismail Elkhrachy wrote:
>>>> Is the output surface coordinates for 
>>>> vtkSurfaceReconstructionFilter scaled? If yes , how to get the 
>>>> surface coordinates according to the input surface coordinates?
>>>
>>> Apparently, origin and spacing are not propagated into the output data
>>> set for some reason by vtkSurfaceReconstructionFilter. They are,
>>> however, propagated to the output information vector of the algorithm.
> [...]
>>> What you could try to fix this, is to obtain the output of
>>> vtkSurfaceReconstructionFilter after a forced pipeline Update() and set
>>> up spacing and origin manually, probably like this:
>>>
>>> | surf->Update();
>>> |
>>> | vtkImageData* signedDist = surf->GetOutput()->ShallowCopy();
>>> | vtkInformation* signedDistInfo = surf->GetOutputPortInformation();
>>> | 
>>> signedDist->SetSpacing(signedDistInfo->Get(vtkDataObject::SPACING()));
>>> | signedDist->SetOrigin(signedDistInfo->Get(vtkDataObject::ORIGIN()));
>>> |
>>> | vtkContourFilter *cf=vtkContourFilter::New();
>>> | cf->SetInput(signedDist);
>
> Here is another try:
>
> | // Include additional headers at the beginning:
> | #include "vtkInformation.h"
> | [...]
> |
> | surf->Update();
> |
> | // Create a new instance of the same type as surf->GetOutput() and 
> make it
> | // a shallow copy
> | vtkImageData* signedDist  = surf->GetOutput()->NewInstance();
> | signedDist->ShallowCopy(surf->GetOutput());
> |
> | vtkInformation* signedDistInfo = surf->GetOutputPortInformation(0);
> | signedDist->SetSpacing(signedDistInfo->Get(vtkDataObject::SPACING()));
> | signedDist->SetOrigin(signedDistInfo->Get(vtkDataObject::ORIGIN()));
> |
> | vtkContourFilter *cf=vtkContourFilter::New();
> | cf->SetInput(signedDist);
>
> I have not tested this either; if there are still errors, you can
> probably resolve them by having a closer look at related documentation.
> Just remember: When in doubt, you need to #include corresponding headers
> for any VTK class that is being used explicitly.
>
>
> Regards
>
> Obada
>
>> Thank you very much Obady for your help;
>> after using your solution i have got 6 errors, I am new by oop c++, 
>> could you please help me?
>> Thank you,
>> Ismail
>>
>> Compiling...
>> Normals_curvatures.cxx
>> C:\Elkhrachy\PhD_Programs\SurfaceGeneration_Normals_Curvatures\Normals_curvatures.cxx(121) 
>> : error C2660: 'ShallowCopy' : function does not take 0 parameters
>> C:\Elkhrachy\PhD_Programs\SurfaceGeneration_Normals_Curvatures\Normals_curvatures.cxx(122) 
>> : error C2660: 'GetOutputPortInformation' : function does not take 0 
>> parameters
>> C:\Elkhrachy\PhD_Programs\SurfaceGeneration_Normals_Curvatures\Normals_curvatures.cxx(123) 
>> : error C2027: use of undefined type 'vtkInformation'
>> c:\program1\vtk\vtk-5.0\vtk\filtering\vtkalgorithm.h(39) : see 
>> declaration of 'vtkInformation'
>> C:\Elkhrachy\PhD_Programs\SurfaceGeneration_Normals_Curvatures\Normals_curvatures.cxx(123) 
>> : error C2227: left of '->Get' must point to class/struct/union
>> C:\Elkhrachy\PhD_Programs\SurfaceGeneration_Normals_Curvatures\Normals_curvatures.cxx(124) 
>> : error C2027: use of undefined type 'vtkInformation'
>> c:\program1\vtk\vtk-5.0\vtk\filtering\vtkalgorithm.h(39) : see 
>> declaration of 'vtkInformation'
>> C:\Elkhrachy\PhD_Programs\SurfaceGeneration_Normals_Curvatures\Normals_curvatures.cxx(124) 
>> : error C2227: left of '->Get' must point to class/struct/union
>> Error executing cl.exe.
>>
>> ICP_3.exe - 6 error(s), 0 warning(s)
Hello Obady;
Ok I used your suggestion and it works after making small editing in line:
vtkInformation* signedDistInfo = 
surf->GetExecutive()->GetOutputInformation(0);
Many Thanks for your time :-D
Regards
Ismail

-- 
M.Sc. Ismail Elkhrachy
PhD student

Institut für Geodäsie und Photogrammetrie
Technische Universität Braunschweig
Gaußstr. 22   
38106 Braunschweig 
Germany

Mob.           : 0049 0163 3623486
Tel.           : 0049 0531 3917497
Fax            : 0049 0531 3917499
E-mail         : I.Elkhrachy at tu-bs.de, I.Elkhrachy at yahoo.com





More information about the vtkusers mailing list