Higher resolution for screen captures of 3D view?

Fyi, HiResScreenCapture module of slicermorph does this fine. You may need s preview version of slicer to run it (current stable lake the features we need)

It would be great if you could share your method here so that other people (and chatbots) can learn : )

Hi @pieper, Sorry for the delay in writing this up.

My quick overview for making scale bars in images for publication. Note that I pay The Adobe Tax and use Photoshop and Illustrator; this is largely because many of the journals I submit to accept these formats natively. In short, this works for me, it is almost certainly not the best way. (Your mileage may vary.)

Method number 1:

  1. Segment your shell (or whatever). Change slicer to Orthogonal view (NOT perspective).
  2. in 3D view, position your model as close as possible to how you’re planning on rendering it in Blender.
  3. Turn on the scale bar in 3D view.
  4. Take a screen capture and keep it as your “reference”.
  5. Export your 3D model and then import into a blender scene.
  6. Change the blender camera to Orthogonal and arrange the view so it is as close as possible to your Slicer reference picture.
  7. Render out to whatever resolution you like and save this as your “rendered” image. This step is a primary reason why I use Blender to do this - I often render 600 dpi images that are over 30" in a single dimension.
  8. In photoshop or Illustrator, load in your reference and rendered images in 2 separate layers. Place your rendered image behind the reference.
  9. Change the opacity of the reference so that you can see the rendered image behind it.
  10. Uniformly scale the reference image until it matches the rendered image.
  11. Make a new layer. With the line tool, draw a scale bar over the scale bar present in the reference image.
  12. make the reference image invisible. You now have a scale bar line that matches the scale. It is arguably not precise, but for most things, it is more than sufficient.

Method 2: probably more precise.

  1. In Slicer, make a new segment in your segmentation that is a 1x1x1 cube. You’ll have to pick the appropriate units for whatever you’re working on; for me I think I used 1cm on a side. You can do this in code using the python function below; I have this in my .slicerrc.py file.
  2. Export this as a model along with your segmented item (shell, whatever).
  3. Import both of these into blender. You now have something that is of perfect known dimensions in Blender, so you can arrange it as needed to make a scale bar either in Blender or in another application.

I generally use method 1 far more often than method 2. I find it to be good enough for my work.

def CubeSegment(volumeName, segmentationName, segmentName, sizeInMillimeters):
    volumeNode = getNode(volumeName)
    segmentationNode = getNode(segmentationName)
    segmentId = segmentationNode.GetSegmentation().GetSegmentIdBySegmentName(segmentName)

    one_unit = round( sizeInMillimeters / volumeNode.GetSpacing()[0] )

    segmentArray = slicer.util.arrayFromSegmentBinaryLabelmap(segmentationNode, segmentId, volumeNode)

    segmentArray[:] = 0
    segmentArray[0:one_unit, 0:one_unit, 0:one_unit] = 1

    slicer.util.updateSegmentBinaryLabelmapFromArray(segmentArray, segmentationNode, segmentId, volumeNode)

Did you try the HiResScreenCapture module in SlicerMorph (you need a preview version)?

It may save you a few steps. I went as far as 9000-10000px, but haven’t tried 18000px.

1 Like

One example:

https://js2.jetstream-cloud.org:8001/swift/v1/SampleData/Rendering/molar.png

1 Like