[vtkusers] output surface coordinates for vtkSurfaceReconstructionFilter

Obada Mahdi omahdi at gmx.de
Mon Dec 11 08:53:34 EST 2006


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)



More information about the vtkusers mailing list