Masking STL for Registration

Hello I need to do registration on a stl of a vessel but I only need to deform part of the stl because I need the top and bottom of it to be flat. Here is a picturevessel

I think I can use masking but I’m not sure how? I need to make sure that the top and bottom of the vessel are flat. Thank you.

My procedure is…

FixedFrame = FrameA
MovingFrame = FrameB

Use ElastiX so FrameB gets transformed into FrameA space.
Change transform to Volume.
Mask Transform Volume with Frame B segment.
Import Masked Transform Volume as Transform.
Apply Transform to FrameB stl.

I do it with masked vs. no mask transform and the results look different?

Frame B stl:
frameB

Resulting stl from non-masked transform (gray)
Resulting stl from masked transform (pink)

result

Why is there a difference between masked vs non-masked? Shouldn’t the transform only apply to the stl? I am currently masking the transform so I don’t have to deal with all the other data, but shouldn’t it have the same effect on the stl as the non-masked transform?

Sorry if this does not make sense. I can try to explain more.

Yes, I think you need to provide more context - what are you trying to accomplish?

Hello and thank you for your reply.

I am trying to transform only part of a stl geometry. I want the other part not to be transformed (1 mm down from the top).

Example picture:
scenario

Here is what I have done:

-Create transform from two vessel volumes
-Import transform as volume
-Use segment to mask part that I want “static” and set inside to “0”
-Export masked transform volume
-import masked transform volume as transform
-Import STL of segment of vessel
-Apply transform to STL
-Harden transform

It seems like the mask is not working.
The static part does not stay static and it deforms so the top of the vessel is no longer flat like I need it to be.

I am not sure if my transform mask looks right. It is the gray circle but it seems like it still has a gradient and is not masking properly but I set the value to 0?
maskfail

Sorry for the confusion.

Okay, that helps. At least I think I get it. Did you turn on the arrows or grid features of the transform visualization to confirm that your masked transform is really what you think it is?

results

Here is a more detailed image of what is happening.

Yes, I turned the grid on and it is black in those places which is why I am confused. Will update with pics in one second.

Original:
1

Segment Mask:
2

Transform Volume with Mask Applied:
3

Parameters used:
parameters

Result grid:
5
Black is applied mostly to my target area but not all the way?

Transformed stl:
4

Masked part was transformed but it wasn’t supposed to be. Arrows show obvious transformation.

One possible error is that my transform has data to transform a much larger geometry (full heart) whereas I am only transforming part of the vessel. When I try to mask a transform to my specific stl shape/segment the result is very jagged and bumpy which is why I use the full transform.

There are a few parts that are being completely ignored.

My mask (tan):
mymask

grid result:
sadness

There is a clear green triangle where the mask is being ignored.