When analysis 3D image data by rendering, some tissue is unconcerned and it would distrub the analysis. Thus, I want to crop the image by a free-hand ROI just like RadiAnt:
This feature is implemented in 3D Slicer (Segment Editor / Scissors effect). You can use it as is, or use the source code in your application, or customize Slicer to do exactly what you need.
It is a little hard for me to retrive the correct pipeline to crop the image by 2D ROI. Could you please tell me briefly about the pipelien so that I can find the details from the source code.
You may add a few breakpoints and step through the code using the debugger to see how it works exactly.
If you find this too complicated and you are implementing a medical imaging application then probably it would make more sense to create your application by customizing/extending Slicer. It has been developed exactly for this purpose for decades, and for tens of millions of dollars.