I’m attempting to use the drawing API (drawing | API | Cornerstone.js) to add bounding boxes, text boxes, etc… to an image stack.
Most API methods in this package expect an SVGDrawingHelper parameter. Where do I get this from? Are there examples for how this API is supposed to be used?
Hmmm… what you have is NOT typically how annotations and the drawing API are utilized. If you have a look at the link I sent previously you will see that there are various annotation (tools) which create and add annotation objects to the viewport elements via the annotationState addAnnotation function. Each annotation tool has a renderAnnotation (where the svg is drawn) which in turn is triggered via a call to triggerAnnotationRender. I suppose if you add your own annotation tool (say for your own custom rectangle - as there is already a RectangleROITool) you will see your rectangle rendered when/after the viewport is rendered.
What you have MIGHT work if the drawing (drawing.drawRect) were to be scheduled to occur on the next annotation frame (i.e. window.requestAnimationFrame(()=> drawing.drawRect...) but not sure this will work and/or is recommended.