- typedef clitk::BinaryImageToMeshFilter<ImageType> BinaryImageToMeshFilterType;
- typename BinaryImageToMeshFilterType::Pointer convert = BinaryImageToMeshFilterType::New();
- convert->SetThresholdValue(m_ThresholdValue);
- convert->SetInput(m_Input);
- convert->Update();
- vtkPolyData* mesh = convert->GetOutputMesh();
- if (GetVerboseFlag()) {
- std::cout << "Mesh has " << mesh->GetNumberOfLines() << " lines." << std::endl;
+ std::vector<vtkSmartPointer<vtkPolyData> > meshes;
+ std::vector<std::string> m_ROINames;
+ meshes.resize(m);
+ m_ROINames.resize(m);
+ for(unsigned int i=0; i<m; i++) {
+
+ // read image
+ // typedef float PixelType;
+ //typedef itk::Image<PixelType, 3> ImageType;
+ ImagePointer input = clitk::readImage<ImageType>(m_InputFilenames[i], false);
+
+ std::ostringstream oss;
+ oss << vtksys::SystemTools::
+ GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(m_InputFilenames[i]));
+ std::string name = oss.str();
+ m_ROINames[i] = name;
+
+ // convert to mesh
+ typedef clitk::BinaryImageToMeshFilter<ImageType> BinaryImageToMeshFilterType;
+ typename BinaryImageToMeshFilterType::Pointer convert = BinaryImageToMeshFilterType::New();
+ convert->SetThresholdValue(m_ThresholdValue);
+ convert->SetInput(input);
+ convert->Update();
+ meshes[i] = convert->GetOutputMesh();
+ if (GetVerboseFlag()) {
+ std::cout << "Mesh has " << meshes[i]->GetNumberOfLines() << " lines." << std::endl;
+ }
+
+ /*
+ // debug mesh write FIXME
+ vtkSmartPointer<vtkPolyDataWriter> wr = vtkSmartPointer<vtkPolyDataWriter>::New();
+ wr->SetInputConnection(convert->GetOutputPort()); //psurface->GetOutputPort()
+ wr->SetFileName("bidon.obj");
+ wr->Update();
+ wr->Write();
+ */