2
votes

I am working with dicom chest PA's. I have no problem loading the images and doing basic thresholding work, however I need to apply some filters. I will be designing my own filters in the future but for now I want to use the MATLAB ones. The images are 16bit and in MATLAB docs it says that fspecial works fine with 16bit images.

When I try using fspecial or the edge functions i get similar results to the images as shown below.

My question: why is this happening and how do i fix it?

Your help is appreciated. Regards,

full_path = 'I:\Find and Treat\Anonymized_Data\000026_20050607112512_1.dcm';
dicominfo_image = dicominfo(full_path);
dicomread_image = dicomread(dicominfo_image);
dicomread_image = mat2gray(dicomread_image);
c = imcomplement(dicomread_image);

figure,
subplot(1,3,1)
imshow(c)
f = fspecial('laplacian');
cf = filter2(f,c);
subplot(1,3,2)
imshow(cf)
f1 = fspecial('log');
cf1 = filter2(f1,c);
subplot(1,3,3)
imshow(cf1)

results

EDIT

I added and modified the following code to take into account the dynamic range and plotted a mesh plot i obtained the following result and error message.

Warning: Error updating LineStrip.

Update failed for unknown reason

Warning: Error updating LineStrip.

Update failed for unknown reason

figure,
subplot(2,3,1)
imshow(c, [])
f=fspecial('laplacian');
cf=filter2(f,c);
subplot(2,3,2)
imshow(cf, [])
f1=fspecial('log');
cf1=filter2(f1,c);
subplot(2,3,3)
imshow(cf1, [])

subplot(2,3,4)
mesh(c)
subplot(2,3,5)
mesh(cf)
subplot(2,3,6)
mesh(cf1)

updated image

EDIT

LINK TO IMAGE FILE

1
Did you tried to overwrite the dynamic range to min/max imshow(cf1, []) ?JohnnyQ
I suggest, you visualize an image with mesh(image) and take a look at the result. If this is wrong, the problems come from filter. If the mesh output looks ok, then you should look at your vizualisation.Steffen
i have update the question to take both the above suggestions into account, it hasn't helped much..bilaly
Have you tried changing the values for the filters? It totally looks like your image has just not enough contrast to make those filters work. Can you post the original image?Ander Biguri
sorry for the slow reply @AnderBiguri i was awaiting permission from the hospital to upload the file, i have uploaded a different one they said i was allowed to use since it's already available online.. i get the same problem with it...bilaly

1 Answers

3
votes

Your images are just too big.

The Laplacian operator is a 3x3 matrix that approximates the second derivative of the images. Your image is 2700x2200 which means that the variability of the pixels in that small size(comparing to the whole image) is neglectable. You can see it better if you plot your Laplacian filter image as imshow(cf(300:end-300,300:end-300), []) removing the boundaries (where you actually have a big gap). To solve this you'll need to or redefine a Laplacian filter with a higher dimension or resize the image you have to a lower size (imresize is your friend).

The same happens with the log filter, but in this case you can do something about it. The default log filter returned by fspecial is 5x5, but you can actually ask fspecial to create bigger filters.

If you call it the following way:

f1=fspecial('log',50,0.3);
cf1=filter2(f1,c);
imshow(cf1, [])

You get the next figure, that looks kind of a good log filter result.

enter image description here