Based on the ImageCPRMapper example, get a screenshot of the cross section of the blood vessel at a central point

Hey vtk community,
according to the ImageCPRMapper example, how do I get a screenshot of the cross section of the blood vessel at this center point based on the point of the center line of the blood vessel, and a cross section of the different layers above and below the cross section of this center line

You need to create as many cente-lines as you want screenshots. The ImageCPRMapper example shows how to create the first screenshot. For the next screenshots (above and below), you need to manually/programmaticaly create new centerlines with points translated above and below the original centerline.

I’m not correct. I’m getting a cross-section of the blood vessels near the center line

my bad, you meant “cross-sections”, (so the vessel appears as a “circle”).
Then you simply need to use the ResliceCursorWidget example. You can feed it with an origin and a plane normal (both extracted from the centerline).

Thanks. I’ll try

Here’s how I implemented it, but for some reason no pictures appear,

        let normals = []
        const referenceDirection = [0, 0, 1]
        for (let i = 0; i < mapper.getCenterlineTangentDirections().length / 3; i++) {
          const tangent = [
            mapper.getCenterlineTangentDirections()[i],
            mapper.getCenterlineTangentDirections()[i + 1],
            mapper.getCenterlineTangentDirections()[i + 2]
          ]
          const normal = [0, 0, 0]
          vtkMath.cross(tangent, referenceDirection, normal)
          vtkMath.normalize(normal)
          normals.push(normal)
        }
        const genericRenderWindow = GenericRenderWindow.newInstance()
        const renderer = genericRenderWindow.getRenderer()
        const renderWindow = genericRenderWindow.getRenderWindow()
        renderer.setBackground([0, 0, 0])
        genericRenderWindow.setContainer(HtmlElement)
        const slicePlane = vtkPlane.newInstance()
        slicePlane.setNormal(...this.normals[0])
        slicePlane.setOrigin(imageData.getCenter())
        const mapper2 = vtkImageResliceMapper.newInstance()
        mapper2.setSlicePlane(slicePlane)

        mapper2.setSlabType(1) // SlabTypes.MAX
        mapper2.setInputData(imageData)

        const actor = vtkImageSlice.newInstance()
        actor.setMapper(mapper2)
        renderer.addActor(actor)
        renderer.setBackground(0.2, 0.3, 0.4)
        renderWindow.render()

I don’t see anything wrong with your code. You might want to check your plane normal.
Alternatively, you can try modifying the ImageResliceMapper example progressively with your code to see when it stops working.

Now the plane can display the image, but the plane normal vector “normals” of my center point calculates the wrong value such as [0,-0,0]. How to calculate the plane normal vector of the center point? And how should the camera’s angle of view be calculated (renderer.getActiveCamera().elevation(angle)), so that it can look at the section of the center point

For the normal vector computation, please consider “geometry” forums.

For the camera, you can set its focal point (center of your image) and its position (center of your image + plane vector if you are in parrallel projection)