Lung cancer detection; Convolution features + Gradient boost

I have a question about converting brain tumor contour data (in DICOM format) which is represented as [x1,y2,z3, x2, y2, z2, …, xn, yn, zn] for a given slice of a 3d MR scan into pixel positions (i, j).

So from DICOM data I’ve extracted these fields:

ContourData:

This field has x,y,z coordinates (in mm) with respect to origin for a given slice. Where z is constant since we are dealing with a single slice.

ImagePositionPatient:

This is the center position of the upper left voxel. Again z is same as the z we have in ContourData since it’s the same single slice. We can consider this as origin and find pixel positions i, j with respect to this.

ex: (-129.746’, ‘-167.203’, z) in mm

Pixel Spacing:

This is the distance between center’s of two adjacent pixel in x and y direction (in mm).

So in theory these information should be enough to designate the pixel positions of each contour coordinate data given the math:

x: contour coordinate on x-axis in mm
y: contour coordinate on y-axis in mm

origin_x: origin on x-axis
origin_y: origin on y-axis

x_spacing: spacing on x-axis
y_spacing: spacing on y-axis

pixel position (i, j):

(x - origin_x) / x_spacing, (y - origin_y) / y_spacing

But with this formula I’m getting these numbers when I am expecting to be getting integers only. Since this will be the ground truth of a brain tumor segmentation project I’m approaching numerical stabilization highly sensitively.

282.4990153603781 253.99960614415122
282.9992122883025 253.49940921622687
287.0007877116975 253.49940921622687
287.4990153603781 253.99960614415122
287.9992122883025 254.49980307207562
288.99960614415124 254.49980307207562

Yes, I’ve tried many online sources to figure out this problem but only one person in a google group had a similar issue which still didn’t answered my particular case. This is a great community to find experts in both medical imaging and deep learning so I hope you can help me out, or even better guide me how to extract X and y from DICOM in the best possible numerically stable way.

Thanks in Advance