function output = getPointIndexInDicomVolume(point,volume,spatial) % the output are the three indices of the given point in the given volume. % i,j,k: output indices k = find(abs(spatial.PatientPositions(:,3)-point(3)) == min(abs(spatial.PatientPositions(:,3)-point(3)))); i = round( (point(1) - spatial.PatientPositions(k,1)) / spatial.PixelSpacings(k,1) ); j = round( (point(2) - spatial.PatientPositions(k,2)) / spatial.PixelSpacings(k,2) ); output = [i,j,k]; end