bounds[Dim - 1] = 0;
padFilter->SetPadLowerBound(bounds);
padFilter->SetPadUpperBound(bounds);
-
+ padFilter->Update();
+
typedef itk::BinaryThresholdImageFilter<InputImageType, InternalImageType> BinarizeFilterType;
typename BinarizeFilterType::Pointer binarizeFilter=BinarizeFilterType::New();
binarizeFilter->SetInput(padFilter->GetOutput());
binarizeFilter->SetUpperThreshold(GetUpperThreshold());
binarizeFilter ->SetInsideValue(this->GetForegroundValue());
binarizeFilter ->SetOutsideValue(this->GetBackgroundValue());
+ padFilter->GetOutput()->ReleaseData();
working_image = binarizeFilter->GetOutput();
typedef itk::BinaryBallStructuringElement<InternalPixelType,Dim> KernelType;
openFilter2->SetForegroundValue(1);
openFilter2->SetKernel(kernel);
openFilter2->Update();
+ working_image->ReleaseData();
working_image = openFilter2->GetOutput();
}
connectFilter->SetBackgroundValue(this->GetBackgroundValue());
connectFilter->SetFullyConnected(false);
connectFilter->Update();
+ working_image->ReleaseData();
+ working_image = connectFilter->GetOutput();
if (this->GetVerboseOptionFlag()) std::cout << ("RelabelComponentImageFilter") << std::endl;
// Sort labels according to size
relabelFilter->InPlaceOn();
relabelFilter->SetInput(connectFilter->GetOutput());
relabelFilter->Update();
+ working_image->ReleaseData();
working_image = relabelFilter->GetOutput();
// End
f->SetFullyConnected(true);
f->SetNumberOfNewLabels(GetNumberOfNewLabels1());
f->Update();
+ working_image->ReleaseData();
working_image = f->GetOutput();
StopCurrentStep<InternalImageType>(working_image);
}
binarizeFilter2->SetUpperThreshold(GetLastKeep());
binarizeFilter2 ->SetInsideValue(0);
binarizeFilter2 ->SetOutsideValue(1);
- // binarizeFilter2 ->Update(); // NEEDED ?
+ binarizeFilter2 ->Update();
+ working_image->ReleaseData();
+ working_image = binarizeFilter2->GetOutput();
typename ConnectFilterType::Pointer connectFilter2 = ConnectFilterType::New();
- connectFilter2->SetInput(binarizeFilter2->GetOutput());
+ connectFilter2->SetInput(working_image);
connectFilter2->SetBackgroundValue(this->GetBackgroundValue());
connectFilter2->SetFullyConnected(false);
+ connectFilter2->Update();
+ working_image->ReleaseData();
+ working_image = connectFilter2->GetOutput();
typename RelabelFilterType::Pointer relabelFilter2 = RelabelFilterType::New();
- relabelFilter2->SetInput(connectFilter2->GetOutput());
+ relabelFilter2->SetInput(working_image);
relabelFilter2->Update();
+ working_image->ReleaseData();
working_image = relabelFilter2->GetOutput();
// Keep main label
f->SetFullyConnected(true);
f->SetNumberOfNewLabels(GetNumberOfNewLabels2());
f->Update();
+ working_image->ReleaseData();
working_image = f->GetOutput();
StopCurrentStep<InternalImageType>(working_image);
}
// closeFilter->SetBackgroundValue(SetBackgroundValue());
closeFilter->SetKernel(structuringElement);
closeFilter->Update();
+ working_image->ReleaseData();
working_image = closeFilter->GetOutput();
StopCurrentStep<InternalImageType>(working_image);
}
typename CastImageFilterType::Pointer caster= CastImageFilterType::New();
caster->SetInput(working_image);
caster->Update();
+ working_image->ReleaseData();
output = caster->GetOutput();
//--------------------------------------------------------------------
cropFilter->SetInput(output);
cropFilter->SetBackgroundValue(GetBackgroundValue());
cropFilter->Update();
+ output->ReleaseData();
output = cropFilter->GetOutput();
StopCurrentStep<MaskImageType>(output);
}
cropFilter->SetLowerBoundaryCropSize(bounds);
cropFilter->SetUpperBoundaryCropSize(bounds);
cropFilter->Update();
+ output->ReleaseData();
output = cropFilter->GetOutput();
}
}