question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restore tool state

See original GitHub issue

cornerstone-core - 2.0.0 cornerstone-tools - 2.0.0

Hello.

I am trying to reuse one of the tools for a different purpose so I am unsure if this is possible or if I would have to write a new tool.

The tool in question is the rectangleRoi

The basic idea is to draw a rectangle based on coordinates with the end result being able to highlight for instance the thorax, we already know based on pixel coordinates where the thorax is but can’t draw it as that would require someone interfacing with the mouse.

One of the ideas that came up was getting how the rectangleRoi saves the tool state which we were able to do by cornerstoneTools.getToolState(element, “rectangleRoi”);

cornerstoneTools.getToolState(element, "rectangleRoi");

which returns something like the following

{
	"data": [{
		"visible": true,
		"active": false,
		"invalidated": false,
		"handles": {
			"start": {
				"x": 882.0269058295971,
				"y": 1500.6502242152467,
				"highlight": true,
				"active": false
			},
			"end": {
				"x": 2353.6322869955156,
				"y": 2430.085201793722,
				"highlight": true,
				"active": false
			},
			"textBox": {
				"active": false,
				"hasMoved": false,
				"movesIndependently": false,
				"drawnIndependently": true,
				"allowedOutsideImage": true,
				"hasBoundingBox": true,
				"x": 2353.6322869955156,
				"y": 1965.3677130044844,
				"boundingBox": {
					"width": 178,
					"height": 25,
					"left": 791.5695067264573,
					"top": 104.93049327354261
				}
			}
		},
		"area": 1367761.5144483089
	}]
}

Then based on the know coordinates of the thorax we could build that object but before doing so we need to know if we will actually be able to use it.

So assuming that we were able to build that same object with the above given properties, is there something like this?

cornerstoneTools.setToolState(element, "rectangleRoi", data);

where data equals to the json posted above?

I tried finding it and thought that cornerstoneTools.addToolState would do it but it does not

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
piepercommented, May 19, 2018

Hi -

I’ve been working on saving and restoring tools to DICOM structured reports so I have some code here that shows how to create a tool state (length tool in this case) and populate it into the cornerstoneTools tool state manager:

https://github.com/OHIF/Viewers/blob/40ae48238b431477787152e1dc6dc92262ce1b58/Packages/ohif-viewerbase/client/lib/handleSR.js#L11-L34

Key call is restoreToolState.

HTH, Steve

0reactions
allcontributors[bot]commented, Feb 5, 2019

@dannyrb

I’ve put up a pull request to add @pieper! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to restore Windows Services to their default state
2. Run "Services repair tool by ESET" with Administrative privileges. To do this right-click on “ServicesRepair.exe” file and choose “Run ...
Read more >
Data Restore Tool - Apps on Google Play
This system app helps you to restore data from your old phone using a cable or a cloud backup. The app is already...
Read more >
Recovery options in Windows - Microsoft Support
Learn about the recovery options in Windows. Find out how to reset your PC, go back to a previous version of Windows, or...
Read more >
Restoring You Windows 10 Machine to a Working State with ...
In this tutorial, we will be showing you how to access this tool in your Windows 10 machine and as well as demonstrate...
Read more >
Best SSD Recovery Software - SysTools
It also recover shift deleted files from NVMe, m.2 SSD. The tool can also retrieve virus corrupted files from solid state drive.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found