int
main(int argc, char * argv[])
{
if (argc != 2)
{
std::cerr << "Usage: " << argv[0] << " outputimagefile " << std::endl;
return EXIT_FAILURE;
}
using PixelType = unsigned char;
using SpatialObjectToImageFilterType =
size[0] = 100;
size[1] = 100;
size[2] = 1;
ImageType::SpacingType spacing;
spacing[0] = 100.0 / size[0];
spacing[1] = 100.0 / size[1];
spacing[2] = 1.0;
imageFilter->SetSpacing(spacing);
constexpr unsigned int numberOfPoints = 6;
radial[0] = 0.0;
radial[1] = 0.0;
radial[2] = 0.0;
center[0] = 50.0;
center[1] = 50.0;
center[2] = 0.0;
constexpr double radius = 40.0;
typename PolygonType::PolygonPointType polygonPoint;
for (unsigned int i = 0; i < numberOfPoints; ++i)
{
radial[0] = radius * std::cos(angle);
radial[1] = radius * std::sin(angle);
polygonPoint.SetPositionInObjectSpace(
point);
polygon->GetPoints().push_back(polygonPoint);
}
polygon->SetIsClosed(true);
polygon->Update();
std::cout << "Polygon Perimeter = "
<< polygon->MeasurePerimeterInObjectSpace() << std::endl;
std::cout << "Polygon Area = " << polygon->MeasureAreaInObjectSpace()
<< std::endl;
imageFilter->SetInput(polygon);
writer->SetFileName(argv[1]);
writer->SetInput(imageFilter->GetOutput());
try
{
imageFilter->Update();
writer->Update();
}
{
std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Standard exception handling object.
Writes image data to a single file.
Templated n-dimensional image class.
Base class for filters that take a SpatialObject as input and produce an image as output....
constexpr unsigned int Dimension
ImageBaseType::PointType PointType
ImageBaseType::SizeType SizeType
ImageBaseType::SpacingType VectorType
static constexpr double pi
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
void SetSize(const SizeValueType val[VDimension])