Comments (3)
Hi, thanks for trying dwv!
For a custom factory, you need a class that exposes the same api as the current factories and to register it, add it to the app.init
config argument (there is a tools
property). I've not tried it for some time, I hope it works well!
For some code that changes the color of a shape, check out the dwv-jqmobile
repo (demo).
I do not know of any custom shape factories repositories.
And for your information, I'm refactoring the factories and draw tools... See #1020 for progress, the goal is to save the annnotations as dicom and not use the Konva json format. The changes are quite big...
from dwv.
Thank you @ivmartel for your kind and quick reply.
I did my best to put your advice into practice but I have been facing some further problems.
I can indeed create a new class that exposes the same api as the currently existing tools and pass it to app.init
using the tools
property. I also needed to add it to the toolList
property which registers the constructors of the various tool classes.
However, I am getting trouble when it comes to registering the shape factories (namely Rectangle
and Roi
, the two I am interested in) as the App initialization function would look for their constructors in a private property called toolOptions
which is not exported.
I tried to work it around by selecting my custom tool (eg. app.setTool("CustomDraw")
) then using setOptions()
with the desired factories, but it breaks anyway at a later stage. In particular, when creating and binding the layer group - cf addViewLayer
and bindLayerGroupToApp
- since the two aforementioned functions look for the Draw
tool specifically to bind the (private) handler with drawing related events.
I could successfully change to color of a shape thanks to your example. Yet changing the font type seems impossible, as the style property is protected and initially instanciated in the App
constructor with no chance of changing it later.
I am basically using bounding boxes (Rectangle) and polygons (Roi). What I am looking for, essentially, is the simplest way to tweak them: display/change the text labels, font type, keep polygons open before closing them on the final double click, remove the trash (shapes would be removed a different way). I would like if possible to keep npm-importing dwv instead of forking the code and doing my changes in there. I have tried so far to extract and duplicate the minimum of code and pull the strings of imports down to where they took me, but I have ended copying most of the package.
Is there any simpler way to achieve this according to you?
Thank you very much for your assistance.
from dwv.
The toolOptions is now exported and allows for adding custom options. It is available in the latest code and will be in the next release (not before september)
I created a gist for an example custom shape: https://gist.github.com/ivmartel/d192402542208aa75e6a1f622cae12ae (update the dwv path to one you locally built)
from dwv.
Related Issues (20)
- Image does not completely fill div HOT 1
- Fix npm publish HOT 1
- Unable to scroll when loading .zip with 1.02GB of size via loadUrls (Cannot allocate array of size: 3458457600 (>2^31)) HOT 1
- Wrong circle and ellipse quantification values for oriented views
- Image not displaying properly HOT 7
- Allow to specify the root html document
- Overlay on zoomed layer
- Add set position to zoom tool
- Wrong slice spacing for DICOM Seg
- Add DICOM SR parsing
- Allow to move roi label independently
- Example of DICOM load, edit and download edited version, issue with DicomWriter HOT 5
- Error Loading multiple images in one tab HOT 1
- Add DICOM image anonymisation
- Switching between multiple images HOT 2
- Export toolOptions to allow for custom tool options
- Support for DICOM Structured Reports (DICOM SR)?
- Unable to use the Draw tool HOT 1
- If you send multiple series and multiple points, right now there are cases with 4 body parts sent to show. I can't show pictures. Is there any way? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dwv.