How to convert coordinates from physical space (xyz) to index space (ijk) by VTK api

I want to Convert coordinates from physical space (xyz) to index space (ijk).
In VTK9.0.0, I find vtkImageData::TransformPhysicalPointToContinuousIndex() recently added can get what I want. But is there any way to get the result in VTK8.2.0?

Hi,
I had similar problem and I tried using ITK for this.
You may try the following python code snippet.
CAUTION: Please note that the below code is not tested. I am just trying to share what I know.

fileNameT1 = str(subjectFolder + "\\structural\\T1.nii")
# Read T1 data.
readerT1 = sitk.ImageFileReader()
readerT1.SetFileName(fileNameT1)
readerT1.LoadPrivateTagsOn()
readerT1.ReadImageInformation()
readerT1.LoadPrivateTagsOn()
imageT1 = sitk.ReadImage(fileNameT1)
return imageT1.TransformPhysicalPointToIndex(pt)

It seems like what I want. I will try it later. Thanks.