Mathew Guilfoyle
2018-02-17 15:28:59 UTC
I am struggling to find the correct way to specify a ChangeMap to supply to the ChangeLabel filter in the R wrapping of SimpleITK.
I can create the filter object but supplying a R list of (vector) pairs of from/to labels causes R to crash. Looking through the SimpleITK docs the ChangeMap is specified as a std::map<double, double> structure and in the R SWIG file there is a DoubleDoubleMap() function specified which seems to be a mechanism to create the map in R. However, despite trying various ways of using the DoubleDoubleMap I cannot get it to work. I can create a DoubleDoubleMap object but then can't supplying the pairs of labels that define the map. One Python example I came across uses the DoubleDoubleMap like this:
import SimpleITK as silk
changeLabel = sitk.ChangeLabelImageFilter()
changeMap = sitk.DoubleDoubleMap()
changeMap[0] = 1
changeMap[1] = 2
etc..
Doing the equivalent indexing in R produces the error:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)?
Does anyone know how to correctly interact with the DoubleDoubleMap object and/or otherwise specify a change map in R?
Many thanks
I can create the filter object but supplying a R list of (vector) pairs of from/to labels causes R to crash. Looking through the SimpleITK docs the ChangeMap is specified as a std::map<double, double> structure and in the R SWIG file there is a DoubleDoubleMap() function specified which seems to be a mechanism to create the map in R. However, despite trying various ways of using the DoubleDoubleMap I cannot get it to work. I can create a DoubleDoubleMap object but then can't supplying the pairs of labels that define the map. One Python example I came across uses the DoubleDoubleMap like this:
import SimpleITK as silk
changeLabel = sitk.ChangeLabelImageFilter()
changeMap = sitk.DoubleDoubleMap()
changeMap[0] = 1
changeMap[1] = 2
etc..
Doing the equivalent indexing in R produces the error:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)?
Does anyone know how to correctly interact with the DoubleDoubleMap object and/or otherwise specify a change map in R?
Many thanks