Closed aledoyen closed 4 years ago
(sorry for my english by the way... 😟)
Please don't ever apologize for who you are. You're already going above and beyond by reporting an issue. Thank you 🤗
Here is the source for the method that is causing you trouble:
This line is the only bit that has changed recently:
measurementData.uuid = measurementData.uuid || uuidv4();
We now assign a unique ID to every measurement when it enters toolState
. I guess this could blow up if you're trying to add toolState
that is not an object. We should probably think about what "types" make sense to allow, and produce developer warnings if a type is used that is not supported (if any).
Hi dannyrb,
Am getting similar error while trying to add a angle tool data to an enabled image, please can you advise what is the solution -
Test code below:
var testtoolDataString = '{"angle":{"data":[{"visible":true,"handles":{"start":{"x":92.40628941112809,"y":109.38908238107877,"highlight":true,"active":false},"end":{"x":112.40628941112809,"y":99.64666043201174,"highlight":true,"active":false,"eactive":false},"start2":{"x":92.40628941112809,"y":109.38908238107877,"highlight":true,"active":false},"end2":{"x":112.40628941112809,"y":119.38908238107877,"highlight":true,"active":false}}}]},"length":{"data":[{"visible":true,"handles":{"start":{"x":30.63388210486889,"y":77.14351868515968,"highlight":true,"active":false},"end":{"x":57.46755322260141,"y":154.21895700205096,"highlight":true,"active":false,"eactive":false}}}]}}';
cornerstoneTools.addToolState(this.state.cornerstoneElement1, 'Angle', testtoolDataString);
The error says: TypeError: Cannot create property 'uuid' on string
and it is pointing to the exact line you have mentioned:
So I added var testallToolData = JSON.parse(testtoolDataString);
And it solved the uuid issue.
But it started another issue as given below:
Any help hugely appreciated.
thanks in advance, Sreevani
Just for you, if this bug is a real problem, blocking a new release or something else of your current project: You can use the 4.12.5 version of CsTools which doesn't contain this issue. I made this temporarly because i needed to make several other features and go on another project but I dropped the idea here if it can help you during coming days.
@getnsv , you are setting the toolState to a string. It should be a plain javascript object that conforms to the expected shape.
Prerequisites
Description
When upgrading from 4.12.5 to 4.13.0, this bug appeared Due to several deadlines i have -> I can't look more after the origin of this bug so i will stay on 4.12.5 for the moment (I suppose that adding a measurementData element would make the job but not sure and not the time for trying it right now) . But I think it's usefull to give you this feedback as soon as possible. TOOLS_NAME.KERISTONE_POINT is a enum of string I use for all the tools I made and use inside the application. If I can do anything to help you more, don't hesitate to ask questions. (sorry for my english by the way... 😟)