IBBM / Cascaded-FCN

Source code for the MICCAI 2016 Paper "Automatic Liver and Lesion Segmentation in CT Using Cascaded Fully Convolutional NeuralNetworks and 3D Conditional Random Fields"
Other
304 stars 127 forks source link

Regarding preprocessing(for step1) #3

Closed cjayanth95 closed 7 years ago

cjayanth95 commented 7 years ago

Hi, I am having trouble understanding pre-processing step. I have dicom images of liver of size 512x512. How do I proceed further?Do I have to resize it to 388x388 and add symmetrical padding of size 92?

Any help would be appreciated.

Thanks.

mohamed-ezz commented 7 years ago

Yes correct, resize and pad. On Jan 12, 2017 6:29 AM, "cjayanth95" notifications@github.com wrote:

Hi, I am having trouble understanding pre-processing step. I have dicom images of liver of size 512x512. How do I proceed further?Do I have to resize it to 388x388 and add symmetrical padding of size 92?

Any help would be appreciated.

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IBBM/Cascaded-FCN/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/ADqENWB-umT1K62U1j91dJlg-Om4i6Jvks5rRaxBgaJpZM4LhXC8 .

cjayanth95 commented 7 years ago

15970587_1181547601966293_1822897106_n

This is the image I get after HU windowing, histogram equalisation, resizing and padding. here is the matlab code I used:

img= dicomread('image'); %pixel values range from -1024 to 1023 img(img>=400 | img<=-100) = -1024; %HU windowing(rescale slope = 1, rescale intercept = 0) img = histeq(img);%histogram equalisation colorimage= ind2rgb(img, gray(2048)); J = imresize(colorimage, [388 388]); % resize paddedimage = padarray(J,[92 92],'symmetric');%symmetric padding paddedimage = uint16(paddedimage);

Am I missing something?

mohamed-ezz commented 7 years ago

Please check the code in the notebook in : https://github.com/IBBM/Cascaded-FCN/blob/master/notebooks/cascaded_unet_inference.ipynb

you can find the preprocessing function named "step1_preprocess_img_slice". We perform clipping not windowing, and no histogram equalization.

cjayanth95 commented 7 years ago

Please look at the prediction at the end. We are getting a blank image.

https://github.com/cjayanth95/liverseg/blob/master/custom_outs.ipynb

mohamed-ezz commented 7 years ago

Did you successfully run our notebook with outputs that make sense ? I would do this first to make sure the setup is correct.

cjayanth95 commented 7 years ago

Actually this is the output we got when we used the data from http://www.ircad.fr/softwares/3Dircadb/3Dircadb1/ . We tried different patients data but our predictions were way off from Ground truth. We are getting blobs in place of the liver. These blobs change when we adjust the prediction probability, but we are unable to predict the whole liver correctly. Would you be able to tell where we can possibly go wrong?

cjayanth95 commented 7 years ago

We used BVLC Caffe but not the caffe that you mentioned( https://github.com/mohamed-ezz/caffe/tree/jonlong ). Will that make any difference?

mohamed-ezz commented 7 years ago

I'd recommend you just run the notebook "as is" and install the mentioned dependencies exactly. Otherwise many things can be wrong and it's difficult to help you.

There's a reason of course to use the mentioned branch ( https://github.com/mohamed-ezz/caffe/tree/jonlong ). The latest caffe version has a different crop layer that does not do center crops by default, so if you want to use it you have to specify an offset for each crop layer so that the operation is a center crop.

cjayanth95 commented 7 years ago

Thanks for the prompt replies. We were able to reproduce the results after specifying the offset for each crop layer. Here is the notebook for the same. https://github.com/cjayanth95/liverseg/blob/master/custom_outs_updated.ipynb

cjayanth95 commented 7 years ago

Hi, Are step1 and step2 supposed to have the same prototxt files? Also is pred2, the prediction for liver lesions? If so, can you take a look at pred2 in our output at the end of step2? Is the output right? https://github.com/cjayanth95/liverseg/blob/master/for_me_legion.ipynb

Thanks.

mohamed-ezz commented 7 years ago

You can diff the 2 prototxts and check. In the notebook you are loading the ground truth (lbl) from a different CT image so they dont match.

The prediction looks ok. I expect those false positives to be removed by the 3D CRF. On Jan 17, 2017 8:27 PM, "cjayanth95" notifications@github.com wrote:

Hi, Are step1 and step2 supposed to have the same prototxt files? Also is pred2, the prediction for liver lesions? If so, can you take a look at pred2 in our output at the end of step2? Is the output right? https://github.com/cjayanth95/liverseg/blob/master/for_me_legion.ipynb

Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IBBM/Cascaded-FCN/issues/3#issuecomment-273255166, or mute the thread https://github.com/notifications/unsubscribe-auth/ADqENetiVpOBcUL9ORGHXaFqdLJ7LEk2ks5rTQgDgaJpZM4LhXC8 .

keesh0 commented 5 years ago

Could you please provide an example of the following fix--

We were able to reproduce the results after specifying the offset for each crop layer.

keesh0 commented 5 years ago

Could you please provide an example of the following fix--

We were able to reproduce the results after specifying the offset for each crop layer.

Here is my updated crop layers (step 1 model) which appeared to work under Cafe 1.0.0 (AWS Python 3 configured)

layer { name: "crop_d3c-d3cc" type: "Crop" bottom: "d3c" current blob size (1, 512, 64, 64) bottom: "u3a" desired blob size (1, 512, 56, 56) top: "d3cc" crop_param { axis: 2 offset: 4 offset: 4 } } layer {

type: "Crop" bottom: "d2c" (1, 256, 136, 136) bottom: "u2a" desired blob size (1, 256, 104, 104) top: "d2cc" crop_param { axis: 2 offset: 16 offset: 16 } } layer { name: "crop_d1c-d1cc" type: "Crop" bottom: "d1c" (1, 128, 280, 280) bottom: "u1a" desired blob size (1, 128, 200, 200) top: "d1cc" crop_param { axis: 2 offset: 40 offset: 40 } } layer { name: "crop_d0c-d0cc" type: "Crop" bottom: "d0c" (1, 64, 568, 568) bottom: "u0a" *desired blob size (1, 64, 392, 392) top: "d0cc" crop_param { axis: 2 offset: 88 offset: 88 } }

offset = (current blob size - desired blob size) / 2

I am down to just the following warning which I hope are related to training and not inference: I0610 23:47:14.142359 4565 net.cpp:744] Ignoring source layer bn_d0b (batch normalization?) I0610 23:47:14.169219 4565 net.cpp:744] Ignoring source layer loss (loss for training?))

manjunathrv1985 commented 3 years ago

Hi, I am having trouble understanding pre-processing step. I have dicom images of liver of size 512x512. How do I proceed further?Do I have to resize it to 388x388 and add symmetrical padding of size 92?

Any help would be appreciated.

Thanks.

15970587_1181547601966293_1822897106_n

This is the image I get after HU windowing, histogram equalisation, resizing and padding. here is the matlab code I used:

img= dicomread('image'); %pixel values range from -1024 to 1023 img(img>=400 | img<=-100) = -1024; %HU windowing(rescale slope = 1, rescale intercept = 0) img = histeq(img);%histogram equalisation colorimage= ind2rgb(img, gray(2048)); J = imresize(colorimage, [388 388]); % resize paddedimage = padarray(J,[92 92],'symmetric');%symmetric padding paddedimage = uint16(paddedimage);

Am I missing something?

hello boss can I get a matlabcode for applying a hu windowing and histogram equalisation on a CT image am working on liver segemntation and disease identification in a CT image using matlab am finding very much difficult in getting code or lead in this if u have any information related to this please share to manju.aps@gmail.com

keesh0 commented 3 years ago

You must following the preprocessing exactly as the model was trained. Got very good results, even for different CT "phase" images. See https://github.com/keesh0/cfcn_test_inference/blob/master/python/test_cascaded_unet_inference.py. Feel free to adapt to your own data. e.-

manjunathrv1985 commented 3 years ago

thank u for u response i want a code in MATLAB and i don't know anything about PYTHON so please help me in this regard

On Wed, May 12, 2021 at 5:09 AM keesh0 @.***> wrote:

You must following the preprocessing exactly as the model was trained. Got very good results even for different CT phase images.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IBBM/Cascaded-FCN/issues/3#issuecomment-839286880, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOFOF35CESVLMDMF27Q6UGDTNG5ZRANCNFSM4C4FOC6A .

--

Thanks&Regards R V Manjunath Asst Professor ECE Dept DSATM Bangalore-82 Mob 8095465146

keesh0 commented 3 years ago

Sorry, you would need to translate from Python to Matlab line by line.

manjunathrv1985 commented 3 years ago

okay thank you

On Thu, May 13, 2021 at 5:33 PM keesh0 @.***> wrote:

Sorry, you would need to translate from Python to Matlab line by line.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/IBBM/Cascaded-FCN/issues/3#issuecomment-840511363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOFOF37SJLNWN736QI53TNDTNO5ZRANCNFSM4C4FOC6A .

--

Thanks&Regards R V Manjunath Asst Professor ECE Dept DSATM Bangalore-82 Mob 8095465146