16 #ifndef mitkCLPolyToNrrd_cpp
17 #define mitkCLPolyToNrrd_cpp
23 #include <vtkPolyData.h>
24 #include <vtkCellArray.h>
30 #include <vtkSmartPointer.h>
31 #include <vtkLinearExtrusionFilter.h>
40 int main(
int argc,
char* argv[])
50 parser.
setTitle(
"2D-Polydata to Nrrd Segmentation");
51 parser.
setDescription(
"Creates a Nrrd segmentation based on a 2d-vtk polydata.");
54 std::map<std::string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
56 if (parsedArgs.size()==0)
60 if ( parsedArgs.count(
"help") || parsedArgs.count(
"h"))
70 vtkSmartPointer<vtkPolyData> circle = surf->GetVtkPolyData();
72 vtkSmartPointer<vtkLinearExtrusionFilter> extruder =
75 extruder->SetInputData(circle);
76 image->GetGeometry()->GetSpacing()[2];
77 extruder->SetScaleFactor(1.);
78 extruder->SetExtrusionTypeToNormalExtrusion();
79 extruder->SetVector(0, 0, image->GetGeometry()->GetSpacing()[2]);
81 surf->SetVtkPolyData(extruder->GetOutput());
84 surfaceToImageFilter->MakeOutputBinaryOn();
85 surfaceToImageFilter->SetInput(surf);
86 surfaceToImageFilter->SetImage(image);
87 surfaceToImageFilter->Update();
91 multiFilter->SetInput(resultImage);
92 multiFilter->Update();
93 resultImage = multiFilter->GetOutput();
95 std::string saveAs = parsedArgs[
"output"].ToString();
97 saveAs = saveAs +
".vtk";
100 saveAs = parsedArgs[
"output"].ToString();
102 saveAs = saveAs +
".nrrd";
Class for storing surfaces (vtkPolyData).
itk::Image< unsigned char, 3 > MaskImageType
void setContributor(std::string contributor)
std::map< std::string, us::Any > parseArguments(const StringContainerType &arguments, bool *ok=nullptr)
static mitk::BaseData::Pointer LoadBaseData(const std::string &path)
Create a BaseData object from the given file.
static bool SaveSurface(mitk::Surface::Pointer surface, const std::string &path)
SaveSurface Convenience method to save an arbitrary mitkSurface.
static bool SaveImage(mitk::Image::Pointer image, const std::string &path)
SaveImage Convenience method to save an arbitrary mitkImage.
void addArgument(const std::string &longarg, const std::string &shortarg, Type type, const std::string &argLabel, const std::string &argHelp=std::string(), const us::Any &defaultValue=us::Any(), bool optional=true, bool ignoreRest=false, bool deprecated=false)
void setCategory(std::string category)
void setArgumentPrefix(const std::string &longPrefix, const std::string &shortPrefix)
itk::Image< double, 3 > FloatImageType
int main(int argc, char *argv[])
void setTitle(std::string title)
void setDescription(std::string description)
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.