Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vector of 8-bit unsigned integer is not supported

I am trying to apply CannyEdgeDetectionImageFilter on a .bmp image using Simple-itk managed dll.

here is my code:

itk.simple.Image image1= SimpleITK.ReadImage("Input.bmp");

ImageFileReader read = new ImageFileReader();
read.SetFileName("Input.bmp");
read.Execute();

CannyEdgeDetectionImageFilter canny = new CannyEdgeDetectionImageFilter();
itk.simple.Image image2= canny.Execute(image1);//I got below exception here.

ImageFileWriter write = new ImageFileWriter();
write.SetFileName("Output.bmp");
write.Execute(image2,"Output.bmp", true);

I got this exception while executing CannyEdgeDetectionImageFilter.

sitk::ERROR: Pixel type: vector of 8-bit unsigned integer is not supported in 2D byclass itk::simple::CannyEdgeDetectionImageFilter

How can I cast this unsupported thing into supported for simpleitk?

here is some aadition to my code.I tried to cast vector of 8-bit unsigned integer into supported one,But here I fail to do this.

CastImageFilter cast = new CastImageFilter();
PixelIDValueEnum p= cast.GetOutputPixelType();
image1= SimpleITK.Cast(image1, p);//I got below exception here.

sitk::ERROR: Filter does not support casting from casting vector of 8-bit unsigned integer to 32-bit float

Is there anything else I could do to work this code?

Any help is appreciated.

like image 385
Shikha Avatar asked Oct 20 '22 12:10

Shikha


1 Answers

For the error of 8-bit unsigned integer not supported in 2D byclass, you may need to change a way when you read the image like:

image = sitk.ReadImage("input.jpg", sitk.sitkInt8)

Now sitk.CurvatureFlow and imgWhiteMatter = sitk.ConnectedThreshold would work.

Hope it helps.

like image 192
Aktaruzzaman Aman Avatar answered Nov 15 '22 05:11

Aktaruzzaman Aman