Get Name of Class#

Synopsis#

Get the name of the class of an object.

Results#

Output::

image is type: Image

Code#

C++#

#include "itkImage.h"

int
main()
{
  constexpr unsigned int Dimension = 2;
  using PixelType = unsigned char;

  using ImageType = itk::Image<PixelType, Dimension>;
  auto image = ImageType::New();

  std::cout << "image is type: " << image->GetNameOfClass() << std::endl;

  return EXIT_SUCCESS;
}

Classes demonstrated#

class LightObject

Light weight base class for most itk classes.

LightObject is the highest level base class for most itk objects. It implements reference counting and the API for object printing. It can be used as a lightweight base class in preference to Object. (LightObject does not support callbacks or modified time as Object does.) All ITK objects should be a subclass of LightObject or Object with few exceptions (due to performance concerns).

See

Object

ITK Sphinx Examples:

\sphinx{Core/Common/GetNameOfClass, Get Name Of Class}

Subclassed by itk::FiniteDifferenceFunction< TDisplacementField >, itk::FiniteDifferenceFunction< TImage >, itk::FiniteDifferenceFunction< TInput >, itk::FiniteDifferenceFunction< TInputImage >, itk::FiniteDifferenceFunction< TSparseImageType >, itk::CellInterface< TPixelType, TCellTraits >::MultiVisitor, itk::CellInterfaceVisitor< TPixelType, TCellTraits >, itk::FiniteDifferenceFunction< TImageType >, itk::GPUContextManager, itk::GPUKernelManager, itk::LabelObject< TLabel, VImageDimension >, itk::MetaDataObjectBase, itk::MRCHeaderObject, itk::NarrowBand< NodeType >, itk::Object, itk::RegionBasedLevelSetFunctionData< TInputImage, TFeatureImage >, itk::RegionBasedLevelSetFunctionSharedData< TInputImage, TFeatureImage, TSingleData >

See itk::LightObject for additional documentation.