# build error with ITK5 SpatialObjects scene

**URL:** https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062
**Category:** Uncategorized
**Created:** [July 19, 2019, 4:43pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062 "2019-07-19T16:43:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pieper](https://discourse.itk.org/user_avatar/discourse.itk.org/pieper/32/22_2.png) [@pieper](https://discourse.itk.org/u/pieper)
#### Post date: [July 19, 2019, 4:43pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/1 "2019-07-19T16:43:33Z")

</div>

Hi -

I tried building Slicer against ITK’s v5.0.0 tag and got the errors below. The normal slicer builds use [an 5.0-rc1](https://github.com/Slicer/Slicer/blob/master/SuperBuild/External_ITK.cmake#L36) so something must have snuck in at the end. Can anyone suggest a fix or point me to a porting doc?

Thanks,  
Steve

```auto
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx: In member function \u2018virtual int vtkMRMLModelStorageNode::ReadDataInternal(vtkMRMLNode*)\u2019:
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:241:25: error: \u2018itk::MeshReaderType<3, double, itk::DefaultDynamicMeshTraits<double, 3, 3, double, float, double> >::SceneType\u2019 has not been declared
         MeshReaderType::SceneType::Pointer scene = readerSH->GetScene();
                         ^ ~~~~~~~~
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:242:25: error: \u2018itk::MeshReaderType<3, double, itk::DefaultDynamicMeshTraits<double, 3, 3, double, float, double> >::SceneType\u2019 has not been declared
         MeshReaderType::SceneType::ObjectListType * objList = scene->GetObjects(1,nullptr);
                         ^ ~~~~~~~~
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:242:53: error: \u2018objList\u2019 was not declared in this scope
         MeshReaderType::SceneType::ObjectListType * objList = scene->GetObjects(1,nullptr);
                                                     ^ ~~~~~~
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:242:53: note: suggested alternative: \u2018URIList\u2019
         MeshReaderType::SceneType::ObjectListType * objList = scene->GetObjects(1,nullptr);
                                                     ^ ~~~~~~
                                                     URIList
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:242:64: error: \u2018scene\u2019 was not declared in this scope
         MeshReaderType::SceneType::ObjectListType * objList = scene->GetObjects(1,nullptr);
                                                                ^ ~~~~
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:242:64: note: suggested alternative: \u2018Scene\u2019
         MeshReaderType::SceneType::ObjectListType * objList = scene->GetObjects(1,nullptr);
                                                                ^ ~~~~
                                                                Scene
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:244:25: error: \u2018itk::MeshReaderType<3, double, itk::DefaultDynamicMeshTraits<double, 3, 3, double, float, double> >::SceneType\u2019 has not been declared
         MeshReaderType::SceneType::ObjectListType::iterator it = objList->begin();
                         ^ ~~~~~~~~
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:245:43: error: \u2018it\u2019 was not declared in this scope
         itk::SpatialObject<3> * curObj = *it;
                                           ^~
/home/pieper/slicer4/latest/Slicer/Libs/MRML/Core/vtkMRMLModelStorageNode.cxx:245:43: note: suggested alternative: \u2018int\u2019
         itk::SpatialObject<3> * curObj = *it;
                                           ^~
                                           int

```

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 19, 2019, 9:09pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/2 "2019-07-19T21:09:45Z")

</div>

There was a significant `SpatialObject` refactoring since RC1. Porting documentation is [here](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Documentation/ITK5MigrationGuide.md#spatial-objects-refactoring). If you run into issues, or absence of instructions, please let us know.

---

<div class="post-metadata">

### Author: ![pieper](https://discourse.itk.org/user_avatar/discourse.itk.org/pieper/32/22_2.png) [@pieper](https://discourse.itk.org/u/pieper)
#### Post date: [July 22, 2019, 2:09pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/3 "2019-07-22T14:09:29Z")

</div>

Thanks @dzenanz 👍 That had most of the info I needed. I just created [a pull request](https://github.com/InsightSoftwareConsortium/ITK/pull/1112) with an extra note that may help the next person.

---

<div class="post-metadata">

### Author: ![pieper](https://discourse.itk.org/user_avatar/discourse.itk.org/pieper/32/22_2.png) [@pieper](https://discourse.itk.org/u/pieper)
#### Post date: [July 22, 2019, 2:35pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/4 "2019-07-22T14:35:39Z")

</div>

@dzenanz - I got past the scene/group issue, but now I’m finding code that uses the spatial object method `ValueAt`. I see that the new methods like `ValueAtInObjectSpace` that are specialized for world space, object space, etc, but I don’t see anything that tells me what space corresponds to the old definition of `ValueAt`.

Specifically, I want this code to compile and function as it did previously:

> <https://github.com/Slicer/Slicer/blob/master/Modules/CLI/ExpertAutomatedRegistration/ITKRegistrationHelper/itkOptimizedImageToImageRegistrationMethod.txx#L295>

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 22, 2019, 3:11pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/5 "2019-07-22T15:11:56Z")

</div>

@Niels_Dekker and @Stephen_Aylward should be better able to answer, or at least point you to the answer.

---

<div class="post-metadata">

### Author: ![Stephen\_Aylward](https://discourse.itk.org/user_avatar/discourse.itk.org/stephen_aylward/32/654_2.png) [@Stephen\_Aylward](https://discourse.itk.org/u/Stephen_Aylward)
#### Post date: [July 22, 2019, 4:03pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/6 "2019-07-22T16:03:35Z")

</div>

Regretfully some of the old spatial object classes implemented ValueAt(point) to operate in WorldSpace, and other classes implemented it to operate in ObjectSpace.

So, you’ll need to determine the intent of your code, and then pick the appropriate ValueAtInWorldSpace() or ValueAtInObjectSpace() function.

Looking at your particular use case, it seems as though ValueAtInWorldSpace() is the “more” correct call. I say “more” correct because the image masks are read using an image file reader, so they cannot be part of a spatial object hierarchy, so their WorldSpace and ObjectSpace will always be equivalent. However, in the future you could imagine using a spatial object reader to get the image mask (e.g., thereby allowing a hierarchy of EllipseSpatialObjects, MeshSpatialObjects, and TubeSpatialObjects to serve as masks) and in that situation WorldSpace is the proper space to use since it would respect the full hierarchy…leading to WorldSpace being the more correct answer in the long run 🙂

Hope this helps,  
Stephen

---

<div class="post-metadata">

### Author: ![pieper](https://discourse.itk.org/user_avatar/discourse.itk.org/pieper/32/22_2.png) [@pieper](https://discourse.itk.org/u/pieper)
#### Post date: [July 22, 2019, 4:36pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/7 "2019-07-22T16:36:19Z")

</div>

Thanks @Stephen_Aylward! WorldSpace it is then.

Now I’m stuck on this build error, something about interpolator types, in case there are any suggestions:

> <https://github.com/BRAINSia/BRAINSTools/issues/449>

---

<div class="post-metadata">

### Author: ![pieper](https://discourse.itk.org/user_avatar/discourse.itk.org/pieper/32/22_2.png) [@pieper](https://discourse.itk.org/u/pieper)
#### Post date: [July 22, 2019, 6:27pm UTC](https://discourse.itk.org/t/build-error-with-itk5-spatialobjects-scene/2062/8 "2019-07-22T18:27:03Z")

</div>

As a follow up, @hjmjohnson suggested just turning off DemonWarp since it isn’t being used. I did this and now everything builds (ready for some testing). Thanks again for the help @dzenanz and @Stephen_Aylward.

> <https://github.com/Slicer/Slicer/pull/1179>
