Produce Image Programmatically


Produce an image programmitically.



Fix Errors Example contains errors needed to be fixed for proper output.



#ifndef __itkImageSource_hxx
#define __itkImageSource_hxx

#include "ImageSource.h"
#include "itkObjectFactory.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"

namespace itk

template <class TImage>
  double a = 2.1;
  itkExceptionMacro("Here is a variable: " << a << " and then more text.");

} // namespace itk


Classes demonstrated

template<typename TOutputImage>
class ImageSource : public itk::ProcessObject, private itk::ImageSourceCommon

Base class for all process objects that output image data.

ImageSource is the base class for all process objects that output image data. Specifically, this class defines the GetOutput() method that returns a pointer to the output image. The class also defines some internal private data members that are used to manage streaming of data.

Memory management in an ImageSource is slightly different than a standard ProcessObject. ProcessObject’s always release the bulk data associated with their output prior to GenerateData() being called. ImageSources default to not releasing the bulk data incase that particular memory block is large enough to hold the new output values. This avoids unnecessary deallocation/allocation sequences. ImageSource’s can be forced to use a memory management model similar to the default ProcessObject behaviour by calling ProcessObject::ReleaseDataBeforeUpdateFlagOn(). A user may want to set this flag to limit peak memory usage during a pipeline update.

ITK Sphinx Examples:

Subclassed by itk::ImageToImageFilter< TDisplacementField, TOutputImage >, itk::ImageToImageFilter< TFeatureImage, TOutputImage >, itk::ImageToImageFilter< TInputImage1, TOutputImage >, itk::ImageToImageFilter< TLabelImage, TOutputImage >, itk::ImageToImageFilter< TLabelMap, TOutputImage >, itk::GenerateImageSource< TOutputImage >, itk::ImageFileReader< TOutputImage, ConvertPixelTraits >, itk::ImageSeriesReader< TOutputImage >, itk::ImageToImageFilter< TInputImage, TOutputImage >, itk::LandmarkDisplacementFieldSource< TOutputImage >, itk::PathToImageFilter< TInputPath, TOutputImage >, itk::PointSetToImageFilter< TInputPointSet, TOutputImage >, itk::RandomImageSource< TOutputImage >, itk::SpatialObjectToImageFilter< TInputSpatialObject, TOutputImage >, itk::Testing::ExtractSliceImageFilter< TInputImage, TOutputImage >, itk::Testing::StretchIntensityImageFilter< TInputImage, TOutputImage >, itk::TransformToDisplacementFieldFilter< TOutputImage, TParametersValueType >, itk::TriangleMeshToBinaryImageFilter< TInputMesh, TOutputImage >, itk::VTKImageImport< TOutputImage >

See itk::ImageSource for additional documentation.