[ITK] [ITK-users] SimpleITK R Wrapping of ChangeLabel and ChangeMap
Richard Beare
richard.beare at gmail.com
Sat Feb 17 17:35:36 EST 2018
I'm afraid this is one thing we haven't yet fixed up in the R bindings.
There aren't useful generators of std::map class bindings in SWIG/R at
present, so you just end up with the class pointers and no methods to
construct or manipulate them. It's on my list. My original plan was to use
named vectors for the common case changing labels, but there are certainly
going to be messy issues in converting keys to strings. However this
approach is probably most like the dictionary method used by python.
On Sun, Feb 18, 2018 at 2:28 AM, Mathew Guilfoyle <mrguilfoyle at gmail.com>
wrote:
> 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
>
>
> The ITK community is transitioning from this mailing list to
> discourse.itk.org. Please join us there!
> ________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> https://itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://itk.org/pipermail/community/attachments/20180218/8e75156d/attachment.html>
-------------- next part --------------
The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
https://itk.org/mailman/listinfo/insight-users
More information about the Community
mailing list