camicroscope / caMicroscope

Digital pathology image viewer with support for human/machine generated annotations and markups.
BSD 3-Clause "New" or "Revised" License
257 stars 295 forks source link

Error using a model over the selected region #453

Closed Brayan-Valenzuela closed 4 years ago

Brayan-Valenzuela commented 4 years ago

Download the caMicroscope, Distro and Caracal repositories, follow the suggested settings in the caMicroscope repo in the "Fast Local Changes" section. I loaded a test classification model and when I tried to run the model on a region of interest it did not work and the console had a TypeError error (see image) but applying the model on the whole image works perfectly. Someone has had a similar error or can you help me with this problem?

image

birm commented 4 years ago

I was easily able to replicate this. Thanks for the report! Debugging now.

Brayan-Valenzuela commented 4 years ago

I was able to fix the problem, I think there is a bug in the repository code that is important to fix soon. The undefined that I show in the photo, is because the object "imgColl" that enters the function "checkSize" of the file "model.js" is asked for parameters that it doesn't have, like for example: "imgColl.features[0]. bound[0]" reviewing the object structure I found that the correct parameter request is: "imgColl.features[0].bound.coordinates[0][0]" when I made a couple of changes taking into account this structure, the viewer works correctly and I solved my problem. I verified this by checking the code of the demo https://wolf.cci.emory.edu//camic_org/apps/viewer/viewer.html?slideId=5bec456369056d7e537c2a9b

and comparing it with the code of my viewer in the local host (attached photo)

I was able to fix the problem, I think there is a bug in the repository code that is important to fix soon. The undefined that I show in the photo, is because the object "imgColl" that enters the function "checkSize" of the file "model.js" is asked for parameters that it doesn't have, like for example: "imgColl.features[0]. bound[0]" reviewing the object structure I found that the correct parameter request is: "imgColl.features[0].bound.coordinates[0][0]" when I made a couple of changes taking into account this structure, the viewer works correctly and I solved my problem. I verified this by checking the code of the demo https://wolf.cci.emory.edu//camic_org/apps/viewer/viewer.html?slideId=5bec456369056d7e537c2a9b

and comparing it with the code of my viewer in the local host (attached photo)

image image

Brayan-Valenzuela commented 4 years ago

I already have a fixed version, in case it helps you.

birm commented 4 years ago

@Brayan-Valenzuela Looks like you maybe beat me to it. That said, if you think your fix is better than #454 (or otherwise are looking to contribute), We'd warmly welcome a pull request!

Brayan-Valenzuela commented 4 years ago

The bug is already fixed, than you for your time.

birm commented 4 years ago

Thank you for your time, and taking the time to make a detailed report!

Brayan-Valenzuela commented 4 years ago

Hi Brim, I've been testing the fix that the repository did in the develop branch, on the issues #453 that I previously reported. Following the same steps that I described in issue #453 I realized there is a visual bug with the segmentation that is done on the image, the segmented region is deformed once the marking is done, and the model runs normally.

birm commented 4 years ago

That's Interesting if concerning. Do you want to attempt a fix, or would you like me to look at it?

Brayan-Valenzuela commented 4 years ago

With the little that I have reviewed the code of the model.js file and comparing it with the one I found in the demo of the caMicroscope page, I made a fix that apparently works, I could share it with you to evaluate it.

Brayan-Valenzuela commented 4 years ago

image image I oly change this 3 lines in the file "model.js" and apparently it works

birm commented 4 years ago

That looks about right to me! Would you like to open a pull request with these changes? :)

Brayan-Valenzuela commented 4 years ago

Yes sure, what I need to do?

birm commented 4 years ago

If you haven't made a fork yet, the easiest thing is to go to the file in github, and click the pencil and make your changes. That will open a pull request automatically.

Brayan-Valenzuela commented 4 years ago

Already request changes on segment.js and model.js files. A new branch called patch-1 was created in my user