[Insight-users] ITK-VTK image and problems with includes in visual c++ express 2008

Matthieu Duvinage matthieu.duvinage at gmail.com
Sat Dec 13 05:56:31 EST 2008


Hello,

In fact, your last proposition is what I need to do. The code I'm using is
just below. However, it doesn't work. The result is a black PNG file. Do you
have an idea ?
The other goal is to be able to use PNG files from another application and
to reconstruct the data to render it afterwards.

Thanks


Matthieu


vtkImageThreshold *mon_tre = vtkImageThreshold::New();
        mon_tre->SetInput(Vol->GetOutput());
        mon_tre->ThresholdByUpper(1300);
        mon_tre->SetInValue(0);
        mon_tre->SetOutValue(255);
        //mon_tre->ReplaceOutOff();
        //mon_tre->ReplaceInOn();
        mon_tre->Update();

vtkPNGWriter *writer=vtkPNGWriter::New();

    writer->SetInput(mon_tre->GetOutput());
    char *wfname=(char *)malloc(sizeof(char)*25);
    sprintf(wfname,"koursky2.png");

    writer->SetFileName(wfname);
    writer->Write();


 Bill Lorensen-2 wrote:
The vtk filters that you ran do not produce a volume. They produce
triangles which represent surfaces.

If you want to produce a thresholded volume, then save the output of
vtkImageThreshold. Set the OutValue to 255 to keep the data within the
range of an unsigned char. The you can use vtk (or itk) to svae the
thresholded volume in PNG files.

However, I still think we do not understand your goals.



2008/12/11 Matthieu Duvinage <matthieu.duvinage at gmail.com>

> Hello everybody,
>
> I'm working on a project in the medical field and I'm using VTK. However,
> the last module I have to create seems to be provided only by ITK. In fact,
> I have to transform a volume in a series of PNG files and the
> ImageSeriesWriter class seems to be devoted to that.
>
> 1) I have compiled the library with CMake and then done the build all and
> install process. I put the repertories in includes and librairies in visual
> studio express 2008 but I have a problem. The program says that the file I
> have to import is not in the directory whereas it is but in a deeper
> directory. I have again this problem when I put the deeper directory in the
> include directories with another file. Is it possible to enable an option in
> visual to force it to look in deeper directories ?
> 2) I would like to use the  normals image (see below) from a VTK class to
> use ImageSeriesWriter. Could you give me an example of how to use that ?
> Because I'm a bit lost with all the classes and the principle of pipeline. I
> have seen that there exist VTKimport or export classes to do something in
> this case but how do I have to do ?
>
> I hope I hear from you soon
>
>
> Matthieu
>
>
> vtkImageThreshold *mon_tre = vtkImageThreshold::New();
>  mon_tre->SetInput(Vol->GetOutput());
>  mon_tre->ThresholdByUpper(1300);
>  mon_tre->SetInValue(0);
>  mon_tre->SetOutValue(3000);
>  //mon_tre->ReplaceOutOff();
>  //mon_tre->ReplaceInOn();
>  mon_tre->Update();
>  vtkContourFilter *contours = vtkContourFilter::New();
>  contours->SetInput(mon_tre->GetOutput());
>  contours->SetValue(1,3000);
>
>  //marsh cube
>    // Iso-surface using marching cubes
>  vtkMarchingCubes* iso = vtkMarchingCubes::New();
>  iso->SetInput(mon_tre->GetOutput());
>  iso->SetValue(1,3000); // Surface #0, iso-value=1
>    //Decimation
>  vtkDecimatePro* decimate=vtkDecimatePro::New();
>  decimate->SetInput(iso->GetOutput());
>  decimate->SetTargetReduction(0.9);
>  decimate->PreserveTopologyOn();
>  decimate->SetMaximumError(0.0002);
>
>
>  // Smoothing
>  vtkSmoothPolyDataFilter* smoother =vtkSmoothPolyDataFilter::New();
>  smoother->SetInput(iso->GetOutput());
>  smoother->SetNumberOfIterations(200);
>  smoother->SetRelaxationFactor(0.05);
>  //smoother->FeatureEdgeSmoothingOn();
>  //smoother->BoundarySmoothingOn();
>
>  vtkPolyDataNormals *normals=vtkPolyDataNormals::New();
>  normals->SetInput(smoother->GetOutput());
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081213/2e4d6199/attachment-0001.htm>


More information about the Insight-users mailing list