Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4424c78b authored by MALANDAIN Gregoire's avatar MALANDAIN Gregoire
Browse files

minor changes

parent 9e09f8b1
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,30 @@ vtTransformation = vtpython._vtTransformation
#
def apply_trsf(image, trsf, ref=None, params="", **kwargs):
"""
Resample an image with a given transformation
Parameters
----------
image : _vtImage or str
the image to be resampled
trsf : _vtTrsf or str
the transformation to be used. This transformation goes from the result image towards the input image.
ref : _vtImage or str
a template image, used to define the geometry of the result image (dimension, voxel size)
params : str
a string containing computation options
kwargs :
additional variables
Returns
-------
If `out_file_path` is found in the additional variables, this procedure will call the inline command.
Hence, `image`, `trsf`, `ref` and `out_file_path` are supposed to be file names.
Else, `image` and `ref` are supposed to be of _vtImage type, `trsf` is supposed to be of _vtTrsf type, and this
function returns a _vtImage.
"""
proc = "apply_trsf"
if params is not None and not isinstance(params, str):
......
......@@ -99,10 +99,16 @@ namespace vt {
template<class T>
py::object _copy_img_to_py_array(vtImage& img)
{
std::string proc = "mv_img_pointer_to_py_array";
py::object o;
std::array<unsigned long, 3> img_shape = img.shape();
T* data = img.data<T>();
if (data == nullptr) {
std::cerr << proc << ": data pointer is already NULL " << std::endl;
return o;
}
if (img.dims() > 1) {
// vectorial image
if ( img_shape[2] > 1 ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment