Obviously, is out of the volume box, even I setup handle positions values way below these values (45 < 367, etc.). I have search several examples of how to feed these values, but I didn’t find something proper.
You specify widget 3D position in rendering (physical) coordinate system, which is not the same as the volume’s voxel coordinate system (you need to to translate, rotate, and scale the axes).
Placement and editing of spline curves, panoramic X-ray reconstruction from curve, nerve segmentation by curve placement, DICOM import/export, segmentation, quantification, registration, surgical planning and guidance, etc. are all readily available in 3D Slicer, for free, without restrictions, even for commercial use. It is unnecessary to redevelop all these low-level features from scratch.
This code even works if the volume is non-linearly transformed (warped to a panoramic X-ray image, or registered to a previous image of the same patient, etc.).
All of those trials tell me that my input values are outside of volume bounds (+++0).
From VTK:
/**
Convenience function computes the structured coordinates for a point x[3].
The voxel is specified by the array ijk[3], and the parametric coordinates
in the cell are specified with pcoords[3]. The function returns a 0 if the
** * point x is outside of the volume, and a 1 if inside the volume.**
*/
virtual int ComputeStructuredCoordinates(
const double x[3], int ijk[3], double pcoords[3]);
This ComputeStructuredCoordinates surely cannot be used in general, because it has no input for axis directions.
To get 3D point position from 2D click position then you need point picking, not just voxel<->physical coordinate system transformation.
If you find that it takes too much time to implement point placement yourself then you can use 3D Slicer. Everything is nicely and conveniently implemented in it, so you don’t need to deal with such low-level details (and if anything is not clear then you can get step-by-step instructions and examples on the Slicer forum). If you prefer to work it out yourself then you can have a look at how this is implemented in existing VTK-based open-source applications, such as ParaView, 3D Slicer, MITK Workbench, etc.
wanting to cross 3 points in my volume (in diagonal). The problem is that the app crash: Run-Time Check Failure #2 - Stack around the variable ‘weights’ was corrupted.