#include <vtkFloatArray.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
+#include <vtkImageMarchingCubes.h>
#include <fpa/Image/DijkstraWithSphereBacktracking.h>
#include <fpa/VTK/ImageMPR.h>
view.SetSize( 800, 800 );
view.SetImage( vtk_image->GetOutput( ) );
+ vtkSmartPointer< vtkImageMarchingCubes > mc =
+ vtkSmartPointer< vtkImageMarchingCubes >::New( );
+ mc->SetInputData( vtk_image->GetOutput( ) );
+ mc->SetValue( 0, 1e-2 );
+ mc->Update( );
+ view.AddPolyData( mc->GetOutput( ), 1, 1, 1, 0.4 );
+
// Allow some interaction
+ view.Render( );
view.Start( );
TImage::IndexType seed_idx;
--- /dev/null
+#include "itkBinaryThinningImageFilter.h"
+#include "itkImage.h"
+#include "itkImageFileReader.h"
+#include "itkImageFileWriter.h"
+#include "itkRescaleIntensityImageFilter.h"
+
+typedef itk::Image<short, 3> ImageType;
+
+int main(int argc, char *argv[])
+{
+
+ typedef itk::ImageFileReader<ImageType> ImageReader;
+ ImageReader::Pointer reader = ImageReader::New();
+ std::string fileName = argv[1];
+ reader->SetFileName(fileName);
+ reader->Update();
+ ImageType::Pointer image = reader->GetOutput();
+
+ typedef itk::BinaryThinningImageFilter <ImageType, ImageType> BinaryThinningImageFilterType;
+ BinaryThinningImageFilterType::Pointer binaryThinningImageFilter = BinaryThinningImageFilterType::New();
+ binaryThinningImageFilter->SetInput(image);
+ binaryThinningImageFilter->Update();
+
+ // Rescale the image so that it can be seen (the output is 0 and 1, we want 0 and 255)
+ typedef itk::RescaleIntensityImageFilter< ImageType, ImageType > RescaleType;
+ RescaleType::Pointer rescaler = RescaleType::New();
+ rescaler->SetInput( binaryThinningImageFilter->GetOutput() );
+ rescaler->SetOutputMinimum(0);
+ rescaler->SetOutputMaximum(255);
+ rescaler->Update();
+
+ typedef itk::ImageFileWriter< ImageType > WriterType;
+ WriterType::Pointer writer = WriterType::New();
+ writer->SetFileName(argv[2]);
+ writer->SetInput(rescaler->GetOutput());
+ writer->Update();
+
+ return EXIT_SUCCESS;
+}
+