Attach cube on segmented surface

Is there any editing tools like “Fill between slices”

I want to attach cube(below pupple colored cube) on the surface(it means segmented region on the slice)

There is an effect called “Fill between slices” in Segment Editor module.

Would you like to 3D print a template that fits on the segmented surface? You can do that by the following steps:

  • Add a new segment
  • Select Scissors effect, set “Operation” to “Fill inside”, “Shape” to “Rectangle”, and “Editable area” to “Outside all segments”, then draw the rectangle in 3D view
  • You can use Islands effect’s “Keep selected island” method to keep only that part of the cube that sits on the surface
1 Like

Thank you. i will do that :slight_smile:
i think 3d slicer is very powerful tool as i think.
3d image processing is very interesting for me
i m in flow in that field. i love it. i am enthusiast!

1 Like

So, I am now automate below behavior using python script.
but, python scrip for effect of hollow and scissors by fiducial was not found

behavior

after generating mesh,

  1. new segment <== it is ok
  2. threshold-smooth <== ok
  3. markup by fiducial <== ok
    4. hollow effect <== not found
    5. scissors effect using markup <== c++ code founded but python not found


image

Scissors effect is developed for interactive use. If you want to place a box on a surface from a script then it is probably much easier to create a box-shaped model node from output of a vtkCurbeSource, then set its pose using a transform node (set translation based on a markups fiducial point position, set orientation by getting the surface normal at the fiducial point), then import the model into a segment in the segmentation node (using segmentationNode.AddSegmentFromClosedSurfaceRepresentation).

1 Like

From your advise, i did 1 box but now extend 9 boxes.
If python script is completed well, let it share this page.

image

You can apply a transform by setting the parent transform node (SetAndObserveTransformNodeID). See in example in Transforms module documentation.

purpose : I make 9 segmentation pads for generating mesh with the brain skin.

I successfully transformed the pad(cylinder object) on the surface of skin by transform module. and i make segmentation node each pad. but like below picture. when i merge segments to one Segementation Node To Send Segment Mesher, but the transformed setting(Rotation,Trans) is disappeard, in other words, my pad object go to (0,0,0) coordinates. I think this is small bug.

Or, Is there any suggestion for generating mesh with multiple Segementation Nodes?


image
image
![image|634x222](upload:/image /adUIarCTEDSAMmdbqbnMrSnknme.png)

I make 9 cylinder object, -> transform node -> segmentation node

cylSource = vtk.vtkCylinderSource()
cylSource.SetRadius(10)
cylSource.SetResolution(50)
cylSource.SetHeight(10)
cylSource.SetCenter([0,0,0])
cylSource.Update()

transform = vtk.vtkTransform()
applyTransform = vtk.vtkTransformPolyDataFilter()
applyTransform.SetTransform(transform)
applyTransform.SetInputConnection(cylSource.GetOutputPort())
applyTransform.Update()

nOfPad = 9
for i in range(0,nOfPad):
    transformlNode = slicer.mrmlScene.AddNode(slicer.vtkMRMLTransformNode())
    segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")
    segmentationNode.AddSegmentFromClosedSurfaceRepresentation(cylSource.GetOutput(), "Pad", [1.0,0.0,0.0])

applyTransform is a filter (you chose a somewhat misleading name). You need to add the output of that filter to the segmentation: segmentationNode.AddSegmentFromClosedSurfaceRepresentation(applyTransform.GetOutput())

Thank you Lasso^^ Aha :slight_smile: :slight_smile:

You should not add new segmentation node for each pad. Instead, create a single segmentation node and add all the pads to that.

but i don not set Rotation on Matrix ^^ . I want to know the fomular or python function to set Matrix from Rx,Ry,Rz

in other words, i want to access python script function for setting below UI Rotation&Translation Value on transformation module, so i can get the transform matrix using

transformNode.SetMatrixTransformToParent(transformMatrix)

image

Yes, you can. The transformation that was applied to the model at the time of import will be preserved in the imported segment.