cornerstone3D
cornerstone3D copied to clipboard
Make Cornerstone Tools more extensible
Explained by use-case
I was trying to make a small customization of the EllipticalROI tool. So I started with extending the existing EllipticalROITool class. (NOTE: I was using Typescript)
The problem was, I wasn't able to call renderAnnotation()
method of the original tool class from the new class and therefore I had to copy the full code of the renderAnnotation()
method to the new class. And this was followed by some hacks to import internal functions/constants that are not publicly exported from tools package.
Possible cause and solution?
I think it is because the renderAnnotation()
method is defined in the form of renderAnnotation = () => {}
.
And to be able to call this function from child classes, it'd better be defined in the form of renderAnnotation() {}
Necessity ?
This will help us to extend the existing tool without fully redefining the methods. Particularly useful when we want to add small changes to the existing tools like additional annotations.