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

Matthieu Duvinage matthieu.duvinage at gmail.com
Thu Dec 11 13:09:31 EST 2008


Hi,

In fact, in the framework of my project, I have to save the volume 
obtained from the different filters (smoothing,...) into PNG files. The 
purpose is to be able to reload the entire volume thanks to the PNG files.

Thank you very much of your answers

Matthieu
Bill Lorensen a écrit :
> Matthieu,
>
> I agree with Mathieu.
>
> What is your end goal?
>
> Bill
>
> On Thu, Dec 11, 2008 at 10:43 AM, Mathieu Malaterre
> <mathieu.malaterre at gmail.com> wrote:
>   
>> Yes. You need to look into something like : vtkPolyDataToImageStencil
>> to turn your unstructured data into structured data.
>>
>> But I would suggest you think twice about it and then simply give up.
>> I do not believe this is what you are looking for.
>>
>>
>> On Thu, Dec 11, 2008 at 4:19 PM, Matthieu Duvinage
>> <matthieu.duvinage at gmail.com> wrote:
>>     
>>> And so, is it impossible to convert the PolyData into the right format and
>>> then save it into PNG files ?
>>> Even with these functions :
>>>
>>> Fonctions:
>>>
>>>
>>>    template<class TOutputImage>
>>>    class itk::ImageSeriesReader< TOutputImage >
>>>
>>>
>>> Data source that reads image data from a series of disk files.
>>>
>>> This class builds an n-dimension image from multiple n-1 dimension image
>>> files. The files stored in a vector of strings are read using the
>>> ImageFileReader
>>> <http://www.itk.org/Doxygen/html/classitk_1_1ImageFileReader.html>. File
>>> format may vary between the files, but the image data must have the same
>>> Size <http://www.itk.org/Doxygen/html/classitk_1_1Size.html> for all
>>> dimensions.
>>>
>>>
>>>    template<class TInputImage, class TOutputImage>
>>>    class itk::ImageSeriesWriter< TInputImage, TOutputImage >
>>>
>>> Writes image data to a series of data files.
>>>
>>> ImageSeriesWriter
>>> <http://www.itk.org/Doxygen/html/classitk_1_1ImageSeriesWriter.html> writes
>>> its input data to a series of output files. The writer is templated over an
>>> input image type and an output image type. Usually, the output image type
>>> will have fewer dimensions than the input image type. Each file has a name
>>> created using the SeriesFormat. This string is used as a sprintf argument to
>>> build a filename. The string should contain zero or one "%d" or equivalent.
>>> The "%d" is an incremental file number that starts at StartIndex and is
>>> incremented by IncrementIndex. Since this writer uses an internal instance
>>> of an ImageFileWriter
>>> <http://www.itk.org/Doxygen/html/classitk_1_1ImageFileWriter.html>, the type
>>> of file is determined by either the file extension or an ImageIO class if
>>> specified.
>>>
>>> Thanks
>>>
>>> Matthieu
>>>
>>>
>>> Bill Lorensen a écrit :
>>>       
>>>> PolyData cannot be written into a series of PNG files. PNG files and
>>>> other image types can only contain image data (pixels).
>>>>
>>>> Neither VTK nor ITK support this.
>>>>
>>>> On Thu, Dec 11, 2008 at 9:19 AM, Matthieu Duvinage
>>>> <matthieu.duvinage at gmail.com> wrote:
>>>>
>>>>         
>>>>> 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());
>>>>> _______________________________________________
>>>>> Insight-users mailing list
>>>>> Insight-users at itk.org
>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>>           
>>>>         
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>       
>>
>> --
>> Mathieu
>>
>>     
>
>   



More information about the Insight-users mailing list