build error with ITK5 SpatialObjects scene

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 so something must have snuck in at the end. Can anyone suggest a fix or point me to a porting doc?

Thanks,
Steve

/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

There was a significant SpatialObject refactoring since RC1. Porting documentation is here. If you run into issues, or absence of instructions, please let us know.

Thanks @dzenanz :+1: That had most of the info I needed. I just created a pull request with an extra note that may help the next person.

1 Like

@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:

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

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 :slight_smile:

Hope this helps,
Stephen

3 Likes

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:

1 Like

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.

2 Likes