[vtkusers] vtkImageResample crash

perron at inwind.it perron at inwind.it
Fri May 27 02:42:22 EDT 2005




With the vtk version after april 2005 this code crash "segmentation fault",



void        baseElaborationWin::print()
{
    char        fileDest[5000];
   
    sprintf(fileDest, "%s/imageprint/%015d.png", BaseDir, time(NULL));
    vtkWindowToImageFilter    *w2f =  vtkWindowToImageFilter::New();
    w2f->SetInput(this);
    vtkPNGWriter        *f2png= vtkPNGWriter::New();
    f2png->SetInput(w2f->GetOutput());
    f2png->SetFileName(fileDest);
    f2png->Write();
    f2png->Delete();

    // scrivo un'immagine più piccola che mi serve come icona....
    sprintf(fileDest, "%s/imageprint/s%015d.png", BaseDir, time(NULL));
    vtkImageResample    *resam= vtkImageResample::New();
    resam->SetInput(w2f->GetOutput());
    int         x, y;
    double        fac=50;
    GetSize(x,y);
    resam->SetAxisMagnificationFactor(2, 0);
    if(x>y)
        fac /= x;
    else
        fac /= y;
    resam->SetAxisMagnificationFactor(0, fac);
    resam->SetAxisMagnificationFactor(1, fac);
    f2png= vtkPNGWriter::New();
    f2png->SetInput(resam->GetOutput());
    f2png->SetFileName(fileDest);
    f2png->Write();
   
    f2png->Delete();
    resam->Delete();
    w2f->Delete();
   
}

-- 
----------------------------
Dott. Giorgio Perron Cabus
Via Grassi 10
10138 - Torino
3280172432





More information about the vtkusers mailing list