<span>Hello, </span><br><br><span>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 ? </span><br><span>The other goal is to be able to use PNG files from another application and to reconstruct the data to render it afterwards. </span><br>
<br><span>Thanks </span><br><br><br><span>Matthieu </span><br><br><br><span>vtkImageThreshold *mon_tre = vtkImageThreshold::New(); </span><br><span> mon_tre->SetInput(Vol->GetOutput()); </span><br><span> mon_tre->ThresholdByUpper(1300); </span><br>
<span> mon_tre->SetInValue(0); </span><br><span> mon_tre->SetOutValue(255); </span><br><span> //mon_tre->ReplaceOutOff(); </span><br><span> //mon_tre->ReplaceInOn(); </span><br><span> mon_tre->Update(); </span><br>
<br><span>vtkPNGWriter *writer=vtkPNGWriter::New(); </span><br><span> </span><br><span> writer->SetInput(mon_tre->GetOutput()); </span><br><span> char *wfname=(char *)malloc(sizeof(char)*25); </span><br><span> sprintf(wfname,"koursky2.png"); </span><br>
<br><span> writer->SetFileName(wfname); </span><br><span> writer->Write(); </span><br><br><br>
<blockquote class="quote light-black dark-border-color">
<div class="quote light-border-color">
<div class="quote-author" style="FONT-WEIGHT: bold"><span>Bill Lorensen-2 wrote:</span></div>
<div class="quote-message shrinkable-quote" style="OVERFLOW-Y: hidden; HEIGHT: 140px"><span>The vtk filters that you ran do not produce a volume. They produce </span><br><span>triangles which represent surfaces. </span><br>
<br><span>If you want to produce a thresholded volume, then save the output of </span><br><span>vtkImageThreshold. Set the OutValue to 255 to keep the data within the </span><br><span>range of an unsigned char. The you can use vtk (or itk) to svae the </span><br>
<span>thresholded volume in PNG files. </span><br><br><span>However, I still think we do not understand your goals. </span><br></div></div></blockquote><br><br>
<div class="gmail_quote">2008/12/11 Matthieu Duvinage <span dir="ltr"><<a href="mailto:matthieu.duvinage@gmail.com">matthieu.duvinage@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello everybody,<br><br>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.<br>
<br>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 ?<br>
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 ?<br>
<br>I hope I hear from you soon<br><br><br>Matthieu<br><br><br>vtkImageThreshold *mon_tre = vtkImageThreshold::New();<br> mon_tre->SetInput(Vol->GetOutput());<br> mon_tre->ThresholdByUpper(1300);<br> mon_tre->SetInValue(0);<br>
mon_tre->SetOutValue(3000);<br> //mon_tre->ReplaceOutOff();<br> //mon_tre->ReplaceInOn();<br> mon_tre->Update();<br> vtkContourFilter *contours = vtkContourFilter::New();<br> contours->SetInput(mon_tre->GetOutput());<br>
contours->SetValue(1,3000);<br><br> //marsh cube<br> // Iso-surface using marching cubes<br> vtkMarchingCubes* iso = vtkMarchingCubes::New();<br> iso->SetInput(mon_tre->GetOutput());<br> iso->SetValue(1,3000); // Surface #0, iso-value=1<br>
//Decimation<br> vtkDecimatePro* decimate=vtkDecimatePro::New();<br> decimate->SetInput(iso->GetOutput());<br> decimate->SetTargetReduction(0.9);<br> decimate->PreserveTopologyOn();<br> decimate->SetMaximumError(0.0002);<br>
<br><br> // Smoothing<br> vtkSmoothPolyDataFilter* smoother =vtkSmoothPolyDataFilter::New();<br> smoother->SetInput(iso->GetOutput());<br> smoother->SetNumberOfIterations(200);<br> smoother->SetRelaxationFactor(0.05);<br>
//smoother->FeatureEdgeSmoothingOn();<br> //smoother->BoundarySmoothingOn();<br><br> vtkPolyDataNormals *normals=vtkPolyDataNormals::New();<br> normals->SetInput(smoother->GetOutput());<br></blockquote></div>
<br>