if (!reader) {
if (exit_on_error) { //default behavior for tools who don't handle the problem
clitkExceptionMacro("Error reading file " << filename << ", exiting immediately");
- } else return NULL;
+ } else return (itk::ImageIOBase *) ITK_NULLPTR;
}
reader->SetFileName(filename);
reader->ReadImageInformation();
return typename ImageType::Pointer(const_cast<ImageType*>(vvImageToITK<ImageType>(m_InputVVImages[n]).GetPointer()));
else {
assert(false); //No input, this shouldn't happen
- return typename ImageType::Pointer(NULL);
+ return typename ImageType::Pointer((ImageType*)ITK_NULLPTR);
}
}
}
// If given, we connect a mask to reference or target
//============================================================================
typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType;
- typename MaskType::Pointer fixedMask=NULL;
+ typename MaskType::Pointer fixedMask=ITK_NULLPTR;
if (m_ArgsInfo.referenceMask_given) {
fixedMask= MaskType::New();
typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageMaskType;
}
typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType;
- typename MaskType::Pointer movingMask=NULL;
+ typename MaskType::Pointer movingMask=ITK_NULLPTR;
if (m_ArgsInfo.targetMask_given) {
movingMask= MaskType::New();
typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageMaskType;
m_CommandIterationUpdate->SetOptimizer(m_GenericOptimizer);
// Set the previous transform parameters to the registration
- // if(m_Initializer->m_Parameters!=NULL )delete m_Initializer->m_Parameters;
+ // if(m_Initializer->m_Parameters!=ITK_NULLPTR )delete m_Initializer->m_Parameters;
m_Initializer->SetInitialParameters(currentCoefficientImages, *newParameters);
registration->SetInitialTransformParametersOfNextLevel(*newParameters);
}
//============================================================================
typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType;
typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageLabelType;
- typename MaskType::Pointer fixedMask = NULL;
- typename ImageLabelType::Pointer labels = NULL;
+ typename MaskType::Pointer fixedMask = ITK_NULLPTR;
+ typename ImageLabelType::Pointer labels = ITK_NULLPTR;
if (m_ArgsInfo.referenceMask_given)
{
fixedMask = MaskType::New();
}
typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType;
- typename MaskType::Pointer movingMask=NULL;
+ typename MaskType::Pointer movingMask=ITK_NULLPTR;
if (m_ArgsInfo.targetMask_given)
{
movingMask= MaskType::New();
// Rigid or Affine Transform
//=======================================================
typedef itk::AffineTransform <double,3> RigidTransformType;
- RigidTransformType::Pointer rigidTransform=NULL;
+ RigidTransformType::Pointer rigidTransform=ITK_NULLPTR;
if (m_ArgsInfo.initMatrix_given)
{
if(m_Verbose) std::cout<<"Reading the prior transform matrix "<< m_ArgsInfo.initMatrix_arg<<"..."<<std::endl;
sTransform->SetGridRegion( transform->GetTransforms()[0]->GetGridRegion() );
sTransform->SetParameters( transform->GetTransforms()[0]->GetParameters() );
regTransform = sTransform;
- transform = NULL; // free memory
+ transform = ITK_NULLPTR; // free memory
}
//=======================================================
typename ConvertorType::Pointer filter= ConvertorType::New();
filter->SetNumberOfThreads(1);
if(m_ArgsInfo.itkbspline_flag)
- sTransform->SetBulkTransform(NULL);
+ sTransform->SetBulkTransform(ITK_NULLPTR);
else
- transform->SetBulkTransform(NULL);
+ transform->SetBulkTransform(ITK_NULLPTR);
filter->SetTransform(regTransform);
#if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 6)
filter->SetReferenceImage(fixedImage);
// Mask
typedef itk::ImageMaskSpatialObject<BLUTCoefficientImageType::ImageDimension > MaskType;
- typename MaskType::Pointer spatialObjectMask=NULL;
+ typename MaskType::Pointer spatialObjectMask=ITK_NULLPTR;
if (!m_MaskFileName.empty())
{
typedef itk::Image< unsigned char, BLUTCoefficientImageType::ImageDimension > ImageMaskType;
template <class args_info_type, class FixedImageType, class MovingImageType>
GenericMetric<args_info_type, FixedImageType, MovingImageType>::GenericMetric()
{
- m_Metric=NULL;
+ m_Metric=ITK_NULLPTR;
m_Maximize=false;
m_Verbose=false;
m_FixedImageRegionGiven=false;
m_FixedImageSamplesIntensityThreshold=0;
m_UseFixedImageSamplesIntensityThreshold=false;
- m_FixedImageMask=NULL;
+ m_FixedImageMask=ITK_NULLPTR;
}
typedef itk::ImageMaskSpatialObject<itkGetStaticConstMacro(FixedImageDimension)> ImageMaskSpatialObjectType;
- typename ImageMaskSpatialObjectType::ConstPointer mask = NULL;
+ typename ImageMaskSpatialObjectType::ConstPointer mask = ITK_NULLPTR;
if (m_FixedImageMask.IsNotNull())
mask = dynamic_cast<const ImageMaskSpatialObjectType*>(m_FixedImageMask.GetPointer());
m_MovingImagePyramid = MovingImagePyramidType::New();
m_FixedImagePyramid = FixedImagePyramidType::New();
m_FieldExpander = FieldExpanderType::New();
- m_InitialDeformationField = NULL;
+ m_InitialDeformationField = ITK_NULLPTR;
m_NumberOfLevels = 3;
m_NumberOfIterations.resize( m_NumberOfLevels );
MultiResolutionPDEDeformableRegistration<TFixedImage,TMovingImage,TDeformationField,TRealType>
::GenerateData()
{
- // Check for NULL images and pointers
+ // Check for ITK_NULLPTR images and pointers
MovingImageConstPointer movingImage = this->GetMovingImage();
FixedImageConstPointer fixedImage = this->GetFixedImage();
unsigned int fixedLevel = vnl_math_min( (int) m_CurrentLevel,
(int) m_FixedImagePyramid->GetNumberOfLevels() );
- DeformationFieldPointer tempField = NULL;
+ DeformationFieldPointer tempField = ITK_NULLPTR;
DeformationFieldPointer inputPtr =
const_cast< DeformationFieldType * >( this->GetInput(0) );
m_FieldExpander->SetOutputDirection( fi->GetDirection());
m_FieldExpander->UpdateLargestPossibleRegion();
- m_FieldExpander->SetInput( NULL );
+ m_FieldExpander->SetInput( ITK_NULLPTR );
tempField = m_FieldExpander->GetOutput();
tempField->DisconnectPipeline();
}
if( tempField.IsNull() )
{
- m_RegistrationFilter->SetInitialDisplacementField( NULL );
+ m_RegistrationFilter->SetInitialDisplacementField( ITK_NULLPTR );
}
else
{
m_FieldExpander->SetOutputSpacing( fi->GetSpacing());
m_FieldExpander->UpdateLargestPossibleRegion();
- m_FieldExpander->SetInput( NULL );
+ m_FieldExpander->SetInput( ITK_NULLPTR );
tempField = m_FieldExpander->GetOutput();
tempField->DisconnectPipeline();
}
// Release memory
- m_FieldExpander->SetInput( NULL );
+ m_FieldExpander->SetInput( ITK_NULLPTR );
m_FieldExpander->GetOutput()->ReleaseData();
- m_RegistrationFilter->SetInput( NULL );
+ m_RegistrationFilter->SetInput( ITK_NULLPTR );
m_RegistrationFilter->GetOutput()->ReleaseData();
}
template<unsigned int Dim>
void clitk::ExtractBonesGenericFilter<ArgsInfoType>::InitializeImageType()
{
- ADD_IMAGE_TYPE(Dim, short);
+ //ADD_IMAGE_TYPE(Dim, short);
// ADD_IMAGE_TYPE(Dim, int);
ADD_IMAGE_TYPE(Dim, float);
}
template<unsigned int Dim>
void AnisotropicDiffusionGenericFilter::InitializeImageType()
{
- ADD_DEFAULT_IMAGE_TYPES(Dim);
+ ADD_IMAGE_TYPE(Dim, float);
+ ADD_IMAGE_TYPE(Dim, double);
}
//--------------------------------------------------------------------
clitk::CropImageGenericFilter::AutoCrop<ImageType>::Do(args_info_type &, ImagePointer, PixelDimType<Dim> *)
{
clitkExceptionMacro("Autocrop is not implemented for vector fields");
- return NULL;
+ return ITK_NULLPTR;
}
//--------------------------------------------------------------------
IteratorType it(input1, input1->GetLargestPossibleRegion());
// typedef input2
- typename ImageType::Pointer input2 = NULL;
+ typename ImageType::Pointer input2 = ITK_NULLPTR;
IteratorType it2;
// Special case for normalisation
// Reading input
typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
- typename MaskImageType::Pointer mask = NULL;
+ typename MaskImageType::Pointer mask = ITK_NULLPTR;
if(mArgsInfo.mask_given) {
mask = this->template GetInput<MaskImageType>(1);
}
// Reading input
typename OutputImageType::Pointer input = this->template GetInput<OutputImageType>(0);
- typename MaskImageType::Pointer mask = NULL;
+ typename MaskImageType::Pointer mask = ITK_NULLPTR;
if(mArgsInfo.mask_given) {
mask = this->template GetInput<MaskImageType>(1);
}
castFilter->SetInput(input);
castFilter->Update();
- typename MaskImageType::Pointer mask = NULL;
+ typename MaskImageType::Pointer mask = ITK_NULLPTR;
if(mArgsInfo.mask_given) {
mask = this->template GetInput<MaskImageType>(1);
}
// Reading input
typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
- typename MaskImageType::Pointer mask = NULL;
+ typename MaskImageType::Pointer mask = ITK_NULLPTR;
if(mArgsInfo.mask_given) {
mask = this->template GetInput<MaskImageType>(1);
}
ImagePointer input)
{
static const unsigned int PixelDimension = itk::PixelTraits<typename ImageType::PixelType>::Dimension;
- return this->Do(window, level, input, static_cast< PixelDimType<PixelDimension> *>(NULL) );
+ return this->Do(window, level, input, static_cast< PixelDimType<PixelDimension> *>(ITK_NULLPTR) );
}
//--------------------------------------------------------------------
PixelDimType<Dim> *)
{
clitkExceptionMacro("Png conversion is not implemented for vector fields");
- return NULL;
+ return ITK_NULLPTR;
}
//--------------------------------------------------------------------
static unsigned int dim = ImageType::ImageDimension;
if (mOutputSize.size() != dim) {
std::cerr << "Please set size with " << dim << " dimensions." << std::endl;
- return NULL;
+ return ITK_NULLPTR;
}
if (mOutputSpacing.size() != dim) {
std::cerr << "Please set spacing with " << dim << " dimensions." << std::endl;
- return NULL;
+ return ITK_NULLPTR;
}
mOutputOrigin.resize(dim);
if (mApplyGaussianFilterBefore && mSigma.size() != dim) {
std::cerr << "Please set sigma with " << dim << " dimensions." << std::endl;
- return NULL;
+ return ITK_NULLPTR;
}
// Some typedefs
IteratorType it(input1, input1->GetLargestPossibleRegion());
// typedef input2
- typename ImageType::Pointer input2 = NULL;
+ typename ImageType::Pointer input2 = ITK_NULLPTR;
IteratorType it2;
// Special case for normalisation
#include <cassert>
vvMeshActor::vvMeshActor() :
- mCutDimension(0), mMesh(NULL),
- mMarching(NULL), mMapper(NULL),
- mActor(NULL),
+ mCutDimension(0), mMesh(ITK_NULLPTR),
+ mMarching(ITK_NULLPTR), mMapper(ITK_NULLPTR),
+ mActor(ITK_NULLPTR),
mSuperpostionMode(false), mTimeSlice(0)
{}
void SetCutSlice(double slice);
/**Initialize the actor and set the inputs. If vf is not null, will use
**it to propagate the contour on all time frames */
- void Init(vvMesh::Pointer mesh,int time_slice, vvImage::Pointer vf=NULL);
+ void Init(vvMesh::Pointer mesh,int time_slice, vvImage::Pointer vf=ITK_NULLPTR);
///Set the time slice (only useful when using a 4D contour)
void SetTimeSlice(int time);
///Toggles between normal 4D mode and superposition mode