Mentions légales du service

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

src/vt/create_trsf.py: add argument

parent 3b95434e
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ _verbose_ = 1
#
############################################################
vtImage = vtpython._vtImage
vtTransformation = vtpython._vtTransformation
......@@ -33,7 +34,7 @@ vtTransformation = vtpython._vtTransformation
# create_trsf
#
def create_trsf(params="", **kwargs):
def create_trsf(image_fixedpoint=None, params="", **kwargs):
proc = "create_trsf"
......@@ -48,12 +49,19 @@ def create_trsf(params="", **kwargs):
if "out_file_path" in kwargs:
if _verbose_ >= 2:
print("call of '" + str(proc) + "': inline command")
if image_fixedpoint is not None and not isinstance(image_fixedpoint, str):
if _verbose_ >= 1:
print(str(proc) + ": unexpected type '" + str(type(image_fixedpoint)) + "'for 'image_fixedpoint'")
return None
if type(kwargs["out_file_path"]) is not str:
if _verbose_ >= 1:
print(str(proc) + ": unexpected type '" + str(type(kwargs["out_file_path"]))
+ "'for 'kwargs[\"out_file_path\"]'")
return None
return subprocess.call(["createTrsf", kwargs["out_file_path"]] + params.split())
cmd_params = kwargs["out_file_path"];
if image_fixedpoint is not None:
cmd_params += ["-template-fixedpoint", image_fixedpoint]
return subprocess.call(["createTrsf"] + cmd_params + params.split())
#
# python procedure
......@@ -61,7 +69,11 @@ def create_trsf(params="", **kwargs):
else:
if _verbose_ >= 2:
print("call of '" + str(proc) + "': python library")
return vtpython._create_trsf(params, "")
if image_fixedpoint is not None and not isinstance(image_fixedpoint, vtImage):
if _verbose_ >= 1:
print(str(proc) + ": unexpected type '" + str(type(image_fixedpoint)) + "'for 'image_fixedpoint'")
return None
return vtpython._create_trsf(image_fixedpoint, params, "")
#
......
......@@ -360,7 +360,7 @@ void vtImageWrapper(py::module m)
.def(py::init<>())
.def(py::init<const std::string&>())
.def("__init__", [](vtImage& img, xt::pyarray<double>& array)
.def("__init__", [](vtImage& img, xt::pyarray<double>& array)
{
new (&img) vtImage();
vt::python::mv_py_array_pointer_to_img(array, img);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment