[vtkusers] RES: panoramic view

Jérôme jerome.velut at gmail.com
Tue Jun 15 14:22:51 EDT 2010


Hi,

I implemented a class that perform a Straightened Curved Planar
Reformation. It reslices a volume orthogonally to a spline, thus
outputs a new volume. If you take the central slice of this output
along the spline (represented now by the z-axis), you should get such
a panoramic view.

You can find the class here: http://github.com/jeromevelut/Chiron in
Algorithms/vtkStraightenedCurvedPlanarReformation

Feel free to you use it, and to ask for help should you need any.

Jerome

2010/6/15 Bill Lorensen <bill.lorensen at gmail.com>:
> Sorry,
>
> try
>  probe->SetInput(pFrame->m_wndView.m_pImageData);
>
> probe->SetSource(rsf->GetOutput()));
>
> On Tue, Jun 15, 2010 at 12:13 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>> Try:
>> probe->SetInput(pFrame->m_wndView.m_pImageDatarsf->GetOutput());
>>
>> probe->SetSource(rsf->GetOutput()));
>>
>> On Tue, Jun 15, 2010 at 9:57 AM, l.a.pereira <l.a.pereira at uol.com.br> wrote:
>>>
>>> vtkParametricSpline* vtkpPs = vtkParametricSpline::New();
>>>
>>> vtkpPs->SetPoints(pts);
>>>
>>> vtkParametricFunctionSource* vtkpPfs = vtkParametricFunctionSource::New();
>>>
>>> vtkpPfs->SetParametricFunction(vtkpPs);
>>>
>>> vtkpPfs->SetUResolution(500);
>>>
>>> vtkTransform *xfm = vtkTransform::New();
>>>
>>> xfm->Translate(0, 0, 70);
>>>
>>> vtkTransformPolyDataFilter *xfmPd = vtkTransformPolyDataFilter::New();
>>>
>>> xfmPd->SetInput(vtkpPfs->GetOutput());
>>>
>>> xfmPd->SetTransform(xfm);
>>>
>>> vtkAppendPolyData *appendPD = vtkAppendPolyData::New();
>>>
>>> appendPD->AddInput(vtkpPfs->GetOutput());
>>>
>>> appendPD->AddInput(xfmPd->GetOutput());
>>>
>>> vtkRuledSurfaceFilter *rsf = vtkRuledSurfaceFilter::New();
>>>
>>> rsf->SetInputConnection(appendPD->GetOutputPort());
>>>
>>> rsf->SetResolution(500, 500);
>>>
>>> rsf->SetRuledModeToResample();
>>>
>>> rsf->Update();
>>>
>>> vtkProbeFilter* probe = vtkProbeFilter::New();
>>>
>>> probe->SetInput(rsf->GetOutput());
>>>
>>> probe->SetSource(pFrame->m_wndView.m_pImageData);
>>>
>>> probe->Update();
>>>
>>> vtkImageData *imagedata = vtkImageData::New();
>>>
>>> imagedata->GetPointData()->SetScalars(probe->GetOutput()->GetPointData()->GetScalars());
>>>
>>> imagedata->SetDimensions(500, 500, 1);
>>>
>>> imagedata->SetSpacing(1, 1, 1);
>>>
>>> imagedata->Update();
>>>
>>> vtkImageMapToColors* colorMap = vtkImageMapToColors::New();
>>>
>>> colorMap->PassAlphaToOutputOff();
>>>
>>> colorMap->SetActiveComponent(0);
>>>
>>> colorMap->SetOutputFormatToLuminance();
>>>
>>> colorMap->SetInput(imagedata);
>>>
>>> colorMap->SetLookupTable(pFrame->m_wndView.m_LookupTable_GrayScale);
>>>
>>> this->m_pImageActor = vtkImageActor::New(); //resulting view 3
>>>
>>> m_pImageActor->PickableOff();
>>>
>>> m_pImageActor->SetInput(colorMap->GetOutput());
>>>
>>> m_pImageActor->SetOrigin(0.0, 0.0, 0.0);
>>>
>>> m_pImageActor->SetPosition(0.0, 0.0, 0.0);
>>>
>>>
>>>
>>> ________________________________
>>>
>>> Mensagem original
>>> De: l.a.pereira < l.a.pereira at uol.com.br >
>>> Para: sercanimailgroups at gmail.com,bill.lorensen at gmail.com <
>>> bill.lorensen at gmail.com >,vtkusers at vtk.org < vtkusers at vtk.org >
>>> Assunto: RES: [vtkusers] panoramic view
>>> Enviada: 15/06/2010 10:51
>>>
>>> Sercani Hello,
>>>
>>> Unfortunately Bill did not find the example code. But I believe there is
>>> very little for me to achieve my goal. I also believe that together we can
>>> solve our problems. I am sending you a piece of code responsible for
>>> generating the images you can see in the attached file. My problem now is
>>> that I am not able to generate the final image in vtkImagedata. It is being
>>> created incorrectly (departure and distorted) as you can see the view number
>>> 3.
>>>
>>> If you can help me solve the distortion in vtkImageData believe we will have
>>> a solution to our problem. Thanks,From the five points of the curve in view
>>> 2 I create a spline curve to refer it to vtkruledsurface and vrkprobefilter.
>>>
>>> Following is the code that generates the image of view 3:
>>>
>>> vtkParametricSpline* vtkpPs = vtkParametricSpline::New();
>>>
>>> vtkpPs->SetPoints(pts);
>>>
>>> vtkParametricFunctionSource* vtkpPfs = vtkParametricFunctionSource::New();
>>>
>>> vtkpPfs->SetParametricFunction(vtkpPs);
>>>
>>> vtkpPfs->SetUResolution(500);
>>>
>>> vtkTransform *xfm = vtkTransform::New();
>>>
>>> xfm->Translate(0, 0, 70);
>>>
>>> vtkTransformPolyDataFilter *xfmPd = vtkTransformPolyDataFilter::New();
>>>
>>> xfmPd->SetInput(vtkpPfs->GetOutput());
>>>
>>> xfmPd->SetTransform(xfm);
>>>
>>> vtkAppendPolyData *appendPD = vtkAppendPolyData::New();
>>>
>>> appendPD->AddInput(vtkpPfs->GetOutput());
>>>
>>> appendPD->AddInput(xfmPd->GetOutput());
>>>
>>> vtkRuledSurfaceFilter *rsf = vtkRuledSurfaceFilter::New();
>>>
>>> rsf->SetInputConnection(appendPD->GetOutputPort());
>>>
>>> rsf->SetResolution(500, 500);
>>>
>>> rsf->SetRuledModeToResample();
>>>
>>> rsf->Update();
>>>
>>> vtkProbeFilter* probe = vtkProbeFilter::New();
>>>
>>> probe->SetInput(rsf->GetOutput());
>>>
>>> probe->SetSource(pFrame->m_wndView.m_pImageData);
>>>
>>> probe->Update();
>>>
>>> vtkImageData *imagedata = vtkImageData::New();
>>>
>>> imagedata->GetPointData()->SetScalars(da);
>>>
>>> imagedata->SetDimensions(500, 500, 1);
>>>
>>> imagedata->SetSpacing(1, 1, 1);
>>>
>>> imagedata->Update();
>>>
>>> vtkImageMapToColors* colorMap = vtkImageMapToColors::New();
>>>
>>> colorMap->PassAlphaToOutputOff();
>>>
>>> colorMap->SetActiveComponent(0);
>>>
>>> colorMap->SetOutputFormatToLuminance();
>>>
>>> colorMap->SetInput(imagedata);
>>>
>>> colorMap->SetLookupTable(pFrame->m_wndView.m_LookupTable_GrayScale);
>>>
>>> this->m_pImageActor = vtkImageActor::New(); //resulting view 3
>>>
>>> m_pImageActor->PickableOff();
>>>
>>> m_pImageActor->SetInput(colorMap->GetOutput());
>>>
>>> m_pImageActor->SetOrigin(0.0, 0.0, 0.0);
>>>
>>> m_pImageActor->SetPosition(0.0, 0.0, 0.0);
>>>
>>>
>>>
>>> -----Mensagem original-----
>>> De: sercani [mailto:sercanimailgroups at gmail.com]
>>> Enviada em: terça-feira, 15 de junho de 2010 04:09
>>> Para: l.a.pereira
>>> Assunto: Re: [vtkusers] panoramic view
>>>
>>>
>>>
>>> Hi Luis,
>>>
>>> Could you manage to solve the panaromic view problem? I have to do the
>>>
>>> same thing(curved MPR) but vtkProbeFilter is working very slowly, it
>>>
>>> couldn't finish the process while the input data set is a 512*512*48
>>>
>>> imagedata and the source is a ruled surface which is created from the
>>>
>>> vtkSplineWidget's polydata...If Bill Lorensen send the sample code, can
>>>
>>> you also send it to me?
>>>
>>>
>>>
>>> Sercani...
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
> _______________________________________________
> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list