[vtkusers] How to cut and flat a volumedata with an spline

Raúl Ferriz raul at torresyvalero.com
Fri Oct 22 06:36:58 EDT 2010


El 21/10/2010 8:28, Raúl Ferriz escribió:
> El 20/10/2010 20:48, Bill Lorensen escribió:
>> BTW, this is sometimes called curvilinear reformatting. It is
>> available on most commercial radiology workstations and many
>> commercial PACS systems. A google search on "curvilinear reformat"
>> will show you many papers and examples.
>>
>> Bill
>>
>> On Wed, Oct 20, 2010 at 2:45 PM, Bill 
>> Lorensen<bill.lorensen at gmail.com>  wrote:
>>> I did this many years ago. This is what I recall...
>>>
>>> I would use the RuledSurfaceFilter to create a surface between two
>>> splines. I assume you have one spline. You can use
>>> vtkTransformPolyDataFilter to create a second spline translated from
>>> the first. �The original and translated splines will be the input to
>>> the ruled surface filter. Then I would use vtkProbeFilter to sample
>>> the imagedata with the ruled surface The input will be the output of
>>> the RuledSurface filter, the Source will be the image data.
>>>
>>> See how that works, then we can attack the flattening issue.
>>>
>>> Bill
>>
>
> Many thanks Bill!!
>
> I will work around this and ask again if I weren't able to this work 
> as I want.
>
Hello users,
I have this code:

         line_sup = vtkPolyData::New();

         this->m_LineaSP->GetPolyData ( line_sup );

         // Create second spline 30 units down
         trans = vtkTransform::New();
         trans->Translate ( 0.0, 0.0, -30.0 );

         transFilter = vtkTransformPolyDataFilter::New();
         transFilter->SetInput ( line_sup );
         transFilter->SetTransform ( trans );
         transFilter->Update ();

         // Merge two lines on one polydata
         vtkAppendPolyData * mergedPolyData = vtkAppendPolyData::New();
         mergedPolyData->AddInput ( line_sup );
         mergedPolyData->AddInputConnection ( transFilter->GetOutputPort 
() );
         mergedPolyData->Update();

         // Create ruled surface
         vtkRuledSurfaceFilter * surface = vtkRuledSurfaceFilter::New();
         surface->SetInputConnection ( mergedPolyData->GetOutputPort() );
         surface->SetOffset ( 0 );
         surface->SetOnRatio ( 2 );
         surface->PassLinesOn ();
         surface->SetRuledModeToResample ();
         surface->SetDistanceFactor ( 60.0 );

         vtkProbeFilter * probe = vtkProbeFilter::New();
         probe->SetSource ( imageData );
         probe->SetInputConnection ( surface->GetOutputPort () ) ;
         probe->Update();


This seems to work, but at probe filter, 
vtkImageData::SafeDowncast(probe->GetOutput()) allways return NULL, if I 
don't safedowncast, object returned seems to have 0 valid points. I had 
checked bounding boxes of mergedPolyData and imageData and they 
intersects, so I can assume that surface is working properly. Am I doing 
something wrong ?



More information about the vtkusers mailing list