SimpleElastix icon indicating copy to clipboard operation
SimpleElastix copied to clipboard

Strange pixels as noise added post-registration

Open markbuckup opened this issue 4 years ago • 4 comments

Hello,

When performing an affine or bspline on my image, strange, dark pixels appear throughout the image. I initially thought this made sense for bspline, as space is being warped and x,y coordinates are left without original RGB values, but I'm also seeing it for the affine?

Is there a way to prevent this? Or is there a way to collect the indices of these pixels so I can account for them myself?

Thanks!

mark Screen Shot 2020-08-13 at 16 32 46

markbuckup avatar Aug 13 '20 20:08 markbuckup

Hi, If this is RGB images and you are using bspline interpolation for the final resampling then you can get values outside of the valid range (do you could have pixels with value 256 there even if input max was 255). Is your image output type float? What is the range of the transformed image? Soren

On Thu, Aug 13, 2020, 22:36 markbuckup [email protected] wrote:

Hello,

When performing an affine or bspline on my image, strange, dark pixels appear throughout the image. I initially thought this made sense for bspline, as space is being warped and x,y coordinates are left without original RGB values, but I'm also seeing it for the affine?

Is there a way to prevent this? Or is there a way to collect the indices of these pixels so I can account for them myself?

Thanks!

mark [image: Screen Shot 2020-08-13 at 16 32 46] https://user-images.githubusercontent.com/56090031/90184406-0efae780-dd83-11ea-85d3-2081ebc11aaa.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SuperElastix/SimpleElastix/issues/388, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHBDDLU2BHNR6H3IICQOP3SARFFTANCNFSM4P62MLHA .

sorenchr2011 avatar Aug 14 '20 05:08 sorenchr2011

@markbuckup thanks for asking. I'm facing a similar problem @sorenchr2011 thanks for pointing this out. Any simple solution to this issue you would recommend? I've tried some other interpolation methods but the noises persisted. In my case, I have greyscale image as moving image while color image as fixed image. Looking forward to any comment. Thanks =)

mynschen avatar Jun 01 '21 16:06 mynschen

I figured out that my pixel noises were generated using np.uint8(), which takes 0.0 as 255 (np.uint8(0.0)=255). A simple solution to this issue: rI = sitk.GetArrayFromImage(resultImage) rI = rI*(rI>0) + (rI<=0) Then np.uint8(rI) will be noise-free.

mynschen avatar Jun 02 '21 02:06 mynschen

a more simple solution: resultImage = sitk.Threshold(resultImage, 0.0001, 1e9, 0.00001) this line can force 0.0 to become a number which is > 0.0, and it works in my computer. @mynschen ,you are right!

heyblackC avatar Oct 11 '21 08:10 heyblackC