juliandewit / kaggle_ndsb2017

Kaggle datascience bowl 2017
MIT License
622 stars 290 forks source link

Count back to absolute slice positions after segmenting nodules #28

Open WGierke opened 7 years ago

WGierke commented 7 years ago

Hi Julian the code works like a charm for me. Thanks! However, I wonder how to count back to the absolute slice positions of a nodule. So currently, one receives coordinates such as 0.1834, 0.5272, 0.71179 in the CSV file for x, y and z. How can I calculate in which slice the respective nodule is (Z axis), being positioned X voxels from left and Y voxels from top? I tried multiplying the values with the image shape e.g. (261, 512, 512) but that gives strange looking results, e.g. 47.8674, 269.9264, 364.43648. Do you know a way to get the correct absolute values? Thanks a lot Willi

teaghan commented 7 years ago

I have the same request. Is it possible to trace these coordinates back to the original .dcm files as well? One issue may be that some of the orders are inverted in step1_preprocess_ndsb.py Also, is there a straight forward translation between the diameter_mm and the number of pixels? Thanks

teaghan commented 7 years ago

so I believe that the helper.pecentage_to_pixels() function is designed to make this translation, @juliandewit is that correct? Something like:

import helpers px, py, pz = helpers.percentage_to_pixels(0.1834, 0.5272, 0.71179, patient_pixel_image_array)

but I am unsure whether or not this will create problems if the order of images were reversed in step1_preprocess_ndsb.py

juliandewit commented 7 years ago

Hello, You guys are right. percentage to pixels takes a 3d volumne and finds the xyz locations given the xyz percentages.

And yes.. you need to take into account flipping and scaling to go back to de dicom. I did not do/try this. I dumped the images (for debugging) right from the patient_pixel_image_array.

WendyDong commented 6 years ago

Has anyone already solved this problem? I‘m new to it. Can you share the solution? Thank you very much!