How to detect the edge of very noisy image?

I have this image of a cell which is very noisy and the edge of the circle cannot be detected. Which filter can be used to get the edge?
traFfrm_074_time_10_crop

Watershed segmentation should work, as there is some intensity difference between the blob and the background, and you can enforce spatial smoothness. See a couple of examples here: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/32_Watersheds_Segmentation.html

1 Like

I applied the watershed but I am getting the inner region of the circle but I need the edge of the circle.

traFfrm_073_time_10_crop_seg

A couple of outstanding edge-preserving smoothing methods:

ITKAnisotropicDiffusionLBR:

There is a browser-based version to try:

http://insightsoftwareconsortium.github.io/ITKAnisotropicDiffusionLBR/

67564a94e9e94f7365b85e32333b52dbb890f270Filtered

ITKTotalVariation:

2 Likes

Thank You very much. After applying the smoothness can I get only the edge of the image?
I tried to save the gradienMagnitudeFilter output. But I could not save it anyhow. Is it gonna give me the edge? Could you please check my code?

int main( int argc, char *argv[] )
{

typedef itk::RGBPixel< unsigned char >RGBPixelType;
typedef itk::Image< RGBPixelType, 2 >RGBImageType;
typedef itk::Vector< float, 3 >VectorPixelType;
typedef itk::Image< VectorPixelType, 2 >VectorImageType;
typedef itk::Image< itk::IdentifierType, 2 >LabeledImageType;
typedef itk::Image< float, 2 >ScalarImageType;
typedef itk::ImageFileReader< RGBImageType >FileReaderType;
typedef itk::VectorCastImageFilter< RGBImageType, VectorImageType >CastFilterType;
typedef itk::VectorGradientAnisotropicDiffusionImageFilter< VectorImageType, VectorImageType >DiffusionFilterType ;
typedef itk::VectorGradientMagnitudeImageFilterGradientMagnitudeFilterType;
typedef itk::WatershedImageFilterWatershedFilterType;
typedef itk::ImageFileWriterFileWriterType;
FileReaderType::Pointer reader = FileReaderType::New();
FileWriterType::Pointer writer = FileWriterType::New();
reader->SetFileName(“G:\My Drive\Shariful\reimages\traFfrm_074_time_10_cropFiltered.png”);
writer->SetFileName( “G:\My Drive\Shariful\reimages\traFfrm_074_time_10_cropFiltered_crop.png” );
CastFilterType::Pointer caster = CastFilterType::New();
DiffusionFilterType::Pointer diffusion = DiffusionFilterType::New();
diffusion->SetNumberOfIterations( std::stoi(“10”) );
diffusion->SetConductanceParameter( std::stod(“9.0”) );
diffusion->SetTimeStep(0.01);
GradientMagnitudeFilterType::Pointer
gradient = GradientMagnitudeFilterType::New();
//gradient->SetUsePrincipleComponents(std::stoi(argv[7]));
WatershedFilterType::Pointer watershed = WatershedFilterType::New();
watershed->SetLevel( std::stod(“0.1”) );
watershed->SetThreshold( std::stod(“0.001”) );
typedef itk::Functor::ScalarToRGBPixelFunctorColorMapFunctorType;
typedef itk::UnaryFunctorImageFilter<LabeledImageType,RGBImageType,ColorMapFunctorType>ColorMapFilterType;
ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();
caster->SetInput(reader->GetOutput());
diffusion->SetInput(caster->GetOutput());
gradient->SetInput(diffusion->GetOutput());
watershed->SetInput(gradient->GetOutput());
colormapper->SetInput(watershed->GetOutput());
writer->SetInput(colormapper->GetOutput());
// Software Guide : EndCodeSnippet
try
{
writer->Update();
}
catch (itk::ExceptionObject &e)
{
std::cerr << e << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

Yes, the gradient magnitude can be used to represent the edge.

Here is an example that demonstrates how to use it – it can be computed on the image intensity:

https://itk.org/ITKExamples/src/Filtering/ImageGradient/ComputeGradientMagnitude/Documentation.html

This filter is useful to get an accurate gradient, which is useful for this low resolution case:

Once you have segmented the blob, you can can compute all kinds of metrics and derived representations quite easily. For example, to get boundary pixels, you can apply morphological erosion operation on the segmented blob and then subtract the result from the original blob.

1 Like