You have set a segmentation node into modelNode variable. As the name suggests, a model node is expected. You can create model nodes from segmentations by exporting segments to model nodes (this creates surface meshes) or by using Segment Mesher extension (this creates volumetric mesh).
“modelNode” is a vtkMRMLSegmentationNode, so it is not a model node. Segmentation node is an input to model generators. You can create model nodes from segmentations by exporting segments to model nodes (this creates surface meshes) or by using Segment Mesher extension (this creates volumetric mesh).
Thanks Adras, I have time so now analysis all of the slicer source code for accumulated and structured knowledges. I think slicer has positive contribution to the medical imaging and communication (like DICOM Concept). Always thinking your slicer community member’s hard working and Voluntary commitment