I have planar contours that turn into this when I select “Export visible segments to models”:
i.e. the contours are not connected.
I think this is because the distance between planes is too large as a result of having transformed all contour points with an affine transformation earlier in the process.
Is there any way to enforce the contours to be connected to get a single closed surface?
The scene contains the unregistered planar contour (SegmentationFromContourPoints_refgeomT1) and the model created from it, which works fine.
It also contains the planar contour from the registered contour points (SegmentationFromContourPoints_refgeomT2) and the model created from it, which leads to the separated planes model shown in the first post.
The registration had almost no visual effect on the planar contours, i.e. the registered planes are barely distinguishable from the unregistered ones by looking at the 3D view. However when creating the models, it works in the unregistered case, but not in the registered one.
I could narrow down the issue a little bit by modifying the contour point coordinates. Scaling all contour point coordinates (x,y,z) with any number between 0.1 and 10 did not lead to a closed surface. However, scaling only the z-coordinate of all contour points by 0.9 resulted in a closed surface. So the problem doesn’t seem to be related only to the absolute distance between the contour planes.
Another modification of contour points that led to a closed surface was to set all z-values of a plane to a constant value (I chose the z-value of the first contour point of each plane). Is it a requirement for all z-values of a contour line to be the same for the conversion to a model to work?
I also noticed that when the conversion to a model results in several planes (as shown in the first post) the conversion to a binary labelmap does not work either, resulting in a map without any foreground pixels.
Sorry, I am still struggling to understand why the conversion to a model doesn’t work in the second case. If anyone could explain to me what I’m doing wrong, that would be great.
I don’t think you’re doing anything wrong, there is an issue with the conversion algorithm. I will take a look tomorrow and see if I can fix the problem.
Planar contour representation (as the name suggests) assumes that each contour are exactly planar. If this assumption is violated then anything can happen (I don’t remember if we check or enforce this and what problems can it cause exactly).
If you want to apply transform to a segmentation then change its master representation to closed surface or binary labelmap.
I am wondering, though, why this is a requirement? The transformed contours are still planar in the sense that all contour points of a contour line are exactly in one plane and all planes are parallel to each other. This is, because the transformation is affine. However, the contour planes are not parallel to the planes of the reference geometry.
Regarding the checks and enforcement, I don’t think there are any, because I used the same pipeline (transform + conversion to binary label map) on more than 200 cases and it seemed to have worked great in all but 2.
Is there anything I can do if my starting point are the registered contours? For some cases I don’t have access to the not transformed contours?
I looked at the code and it seems that only consistent spacing is checked, but not enforced. I did not find any trace for requiring all planes to be parallel in the closed surface conversion, only in the ribbon one.
After the affine transform the spacing should still be consistent and all planes should still be parallel to each other. So these checks/warnings shouldn’t be triggered in this case (and I didn’t notice any warnings during conversion). Did I understand correctly that for this case a check for parallelism between the contour line planes and the reference geometry z-planes would be required?
I’m not sure, but I think if you attach a full log from a session when the conversion fails, then @Sunderlandkyl who is most familiar with this particular converter could hopefully figure out the root cause of the problem.
@Sunderlandkyl: Thanks for looking at this. The conversion failure can be reproduced from the scene I linked. I right-click on the segmentation of the SegmentationFromContourPoints_refgeomT2 node and select “Export visible segments to models”. This leads to the failed model from the first post. Is this sufficient? If not, I’ll send the session log.