kaggle_ndsb2017 icon indicating copy to clipboard operation
kaggle_ndsb2017 copied to clipboard

Count back to absolute slice positions after segmenting nodules

Open WGierke opened this issue 7 years ago • 4 comments

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

WGierke avatar Sep 17 '17 21:09 WGierke

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 avatar Sep 18 '17 16:09 teaghan

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

teaghan avatar Sep 18 '17 23:09 teaghan

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.

juliandewit avatar Oct 21 '17 07:10 juliandewit

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

WendyDong avatar Apr 11 '18 09:04 WendyDong