vtkvmtkCurvedMPRImageFilter的使用

vtkPolyData * centerline = vtkPolyData::New();

        vtkSmartPointer< vtkPoints > pointsc= vtkSmartPointer< vtkPoints >::New();
        vtkSmartPointer< vtkCellArray > linesc= vtkSmartPointer< vtkCellArray >::New();

        centerline->SetPoints(pointsc);
        centerline->SetLines(linesc);
        vtkIdType ptIds[2];

        centerline->GetPoints()->SetNumberOfPoints(2);
        centerline->GetLines()->Reset();
        ptIds[0] = 0;
        ptIds[1] = 1;
        centerline->GetLines()->InsertNextCell(2, ptIds);

        vtkPoints *centerlinePoints = centerline->GetPoints();
        double pt1[3]={122.76,122.76,88.5};
        double pt2[3]={0,0,88.5};
        centerlinePoints->SetPoint(0, pt1);
        centerlinePoints->SetPoint(1, pt2);


        vtkSmartPointer<vtkDoubleArray> FSTangents = vtkSmartPointer<vtkDoubleArray>::New();
         FSTangents->SetName("FSTangents");
         FSTangents->SetNumberOfTuples(1);
         FSTangents->InsertNextValue(1.0);
         FSTangents->InsertNextValue(1.0);
         FSTangents->InsertNextValue(1.0);
         centerline->GetPointData()->AddArray(FSTangents);
         centerline->Modified();

         vtkSmartPointer<vtkDoubleArray> ParallelTransportNormals = vtkSmartPointer<vtkDoubleArray>::New();
          ParallelTransportNormals->SetName("ParallelTransportNormals");
          ParallelTransportNormals->SetNumberOfTuples(1);
          ParallelTransportNormals->InsertNextValue(1);
          ParallelTransportNormals->InsertNextValue(1);
          ParallelTransportNormals->InsertNextValue(1);
          centerline->GetPointData()->AddArray(ParallelTransportNormals);
          centerline->Modified();


        auto cpr = vtkvmtkCurvedMPRImageFilter::New();
        cpr->SetInputConnection(myMapToColors->GetOutputPort());
        cpr->SetCenterline(centerline);
        cpr->SetParallelTransportNormalsArrayName("ParallelTransportNormals");

        cpr->SetFrenetTangentArrayName("FSTangents");
        cpr->SetInplaneOutputSpacing(0.4, 0.4);
        cpr->SetInplaneOutputSize(10, 10);
        cpr->SetReslicingBackgroundLevel(0);
        cpr->Update();

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章