bodokaiser / mrtoct-tensorflow

Tensorflow models for MRI to CT synthesis.
https://arxiv.org/abs/1901.05259
26 stars 5 forks source link

Confusion in dimension of volume. #16

Open sudarshanregmi opened 4 years ago

sudarshanregmi commented 4 years ago

I inspected the shape of RIRE dataset. CTs have the dimension (512, 512) with slices ranging within 20 to 50 while MRs have the dimension (256, 256) with a similar range of slices as that of MRs. But, at the preprocessing and evaluation notebook, I notice that you have plotted (i)th slice which is greater than 60. Also, the spatial dimension differs from that of original CT/MR data.

For example, from the output of pixtopix notebook, the dimensions of validation data are :-

[(105, 298, 227, 1), (190, 328, 282, 1), (202, 307, 276, 1), (198, 329, 262, 1)]

How did you get such dimension? Even in masking notebook, code is plotting 120th slice while I find that number of slices isn't greater than 60 in RIRE dataset. Also, the heigh*width dimension of single slice is confusing me (For example, how did we get (298, 227) in the first dimension above. Shouldn't it have one of the dimension (512, 512) or cropped (384, 384) dimension). And, are you upsampling the depth of 3d volume? I am definitely missing something here. Please, help.

bodokaiser commented 4 years ago

@sudarshanregmi

You should check these two repositories:

  1. https://github.com/bodokaiser/mrtoct-scripts
  2. https://github.com/bodokaiser/mrtoct-matlab

I think the first one alone should be sufficient.

sudarshanregmi commented 4 years ago

Thank you very much for replying. I obtained the data from this link [ https://github.com/bodokaiser/mrtoct-scripts ]. I ran all the scripts there. (download.py, coregister.py followed by clean.py). Are there some modifications I need to make in those scripts? Cause after running those scripts, I am getting the final shape (512, 512, x) where x has values in [20, 52] range.

bodokaiser commented 4 years ago

@sudarshanregmi sry for the late response, I didn't receive a notification per Email for some reason...

The pre-processing doesn't touch the depth dimension because it doesn't matter for 2D convolutional networks (height and width do matter for 2D). One could of course try to adjust the pre-processing to interpolate the depth dimension. This might help for some use cases in others I would expect that this leads to overfitting.

Is there something specific you are trying to do or do you just want to replicate the results? You can also send me an email if you want.

Best, Bodo

sudarshanregmi commented 4 years ago

Actually, I'm trying to replicate the results from your paper. After obtaining the data from mrtoct-scripts, I ran the scripts in mrtoct-tensorflow repo. I think I didn't get the good results since I didn't remove defective slices introduced by coregistration process. I looked at the preprocessing.ipynb. And, saw that you removed the misaligned slices.

But, I am curious how did you obtain such a large number of slices. The dimension I got from mrtoct-scripts after coregistration are somewhat like this:-

[(512, 512, 49), (512, 512, 40), (512, 512, 42), (512, 512, 29),.......]

Did you upsample the number of slices? Is there any way we can ensure to obtain coregistered volumes without any defective slices?

I am planning to remove the defective slices of MR and corresponding slices of CT manually. Maybe after removing defective slices, I might be able to get results closer to what your paper reports. :)

On Thu, Sep 17, 2020 at 11:29 PM Bodo Kaiser notifications@github.com wrote:

@sudarshanregmi https://github.com/sudarshanregmi sry for the late response, I didn't receive a notification per Email for some reason...

The pre-processing doesn't touch the depth dimension because it doesn't matter for 2D convolutional networks (height and width do matter for 2D). One could of course try to adjust the pre-processing to interpolate the depth dimension. This might help for some use cases in others I would expect that this leads to overfitting.

Is there something specific you are trying to do or do you just want to replicate the results? You can also send me an email if you want.

Best, Bodo

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bodokaiser/mrtoct-tensorflow/issues/16#issuecomment-694393909, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVUGTNW76LNBF3UG4IX623SGJDI7ANCNFSM4RJV4ITQ .

bodokaiser commented 4 years ago

Did you upsample the number of slices?

I don't think so. My dataset comprises all slices; I don't train patient-wise but on all slices of all patients.

Is there any way we can ensure to obtain coregistered volumes without any defective slices?

I didn't found one. These coregistration algorithms are very complex so you don't want to write them yourself. One might think about interpolating in the slice dimension so that one can keep more "border" slices. My experience with this is that you will also have more defect slices.

I am planning to remove the defective slices of MR and corresponding slices of CT manually. Maybe after removing defective slices, I might be able to get results closer to what your paper reports.

You might want to check these files. They contain volumes and training checkpoints.

Beyond that, I believe I am only of limited help as I switched fields many years ago.

sudarshanregmi commented 4 years ago

Thank you so much for replying. Your replies definitely helped me. Wish you all the best in your field. :)

sudarshanregmi commented 4 years ago

The minimum value of original CT images seems -1024. But, your data has a minimum value of 0 in both CT and MR modality. Did you translate the values such that -1024 coincides with 0?

bodokaiser commented 4 years ago

@sudarshanregmi see here

I use, for example, data.transform.MinMaxNormalization() and data.transform.ConstNormalization(tf.uint16.max).

sudarshanregmi commented 4 years ago

Oh, thanks! :)

liu123-t commented 2 years ago

I want to know how to get so many slices, because a patient in my RIRE Dataset only have 20-50 slices

bodokaiser commented 2 years ago

@sudarshanregmi

You should check these two repositories:

  1. https://github.com/bodokaiser/mrtoct-scripts
  2. https://github.com/bodokaiser/mrtoct-matlab

I think the first one alone should be sufficient.

@liu123-t if the second link, in particular, reslice.m does not answer your question, there is not much more I can do.