DeepMicroscopy / SlideRunner

SlideRunner is a tool for massive cell annotations in whole slide images
GNU General Public License v3.0
75 stars 10 forks source link

SQLite Missing Table Log #18

Closed jeffshek closed 6 years ago

jeffshek commented 6 years ago
  File "/sites/histowiz/SlideRunner/SlideRunner/gui/annotation.py", line 35, in addSpotAnnotation
    self.db.insertNewSpotAnnotation(xpos_orig,ypos_orig, self.slideUID, classID,self.retrieveAnnotator(event), type=typeAnno )
  File "/sites/histowiz/SlideRunner/SlideRunner/dataAccess/database.py", line 487, in insertNewSpotAnnotation
    self.addAnnotationLabel(classId=classID, person=annotator, annoId=annoId)
  File "/sites/histowiz/SlideRunner/SlideRunner/dataAccess/database.py", line 411, in addAnnotationLabel
    self.logLabel(newid)
  File "/sites/histowiz/SlideRunner/SlideRunner/dataAccess/database.py", line 402, in logLabel
    self.execute(query)
  File "/sites/histowiz/SlideRunner/SlideRunner/dataAccess/database.py", line 526, in execute
    return self.dbcur.execute(query)
sqlite3.OperationalError: no such table: Log
[1]    8502 abort      python main.py

Hi - Came across this the other day, this looks really cool! I was trying it out but ran into an issue where Log doesn't exist in the sqlite table.

I opened the sqlite table opened locally and didn't see the table exist either (but could tell the other ones such as Annotations, etc were created successfully).

I dug around and found what appears to be the area that creates the sqlite database -- however, it doesn't have the Log table creation here.

https://github.com/maubreville/SlideRunner/blob/906c9b3d38f43336be51638751b1d4bfa3f92b33/SlideRunner/dataAccess/database.py#L631

It looks like this Table is created on-the-fly if it doesn't exist and checked at https://github.com/maubreville/SlideRunner/blob/906c9b3d38f43336be51638751b1d4bfa3f92b33/SlideRunner/dataAccess/database.py#L157

But however, the SQL at

PRAGMA table_info('Log')

results in returning an empty List, but an empty List that's passed to https://github.com/maubreville/SlideRunner/blob/906c9b3d38f43336be51638751b1d4bfa3f92b33/SlideRunner/dataAccess/database.py#L53 returns True (thus, the check for a "Log" table says True when it still hasn't been created).

Or I might be completely wrong! Definitely defer to your expertise here, but I'm happy to open a pull-request to create a Log table upon DatabaseCreation if that's what your intended architecture is.

maubreville commented 6 years ago

Thanks for pointing this out! I will have a look at this very soon! The log in the database was only introduced recently, so maybe this is an implementation artifact of this new structure. :-)

maubreville commented 6 years ago

Dear Jeffrey,

thanks again for putting all that effort into debugging. I did apparently not thoroughly check that TABLE_INFO could also return an empty list, rather than None. I added this check now.

Could you confirm if this solves the issue for you?

Best regards,

Marc

jeffshek commented 6 years ago

Great, I pulled from master and it worked! I was able to test around annotation with a reasonable 1 gb+ image. I'm having a slight issue with polygons annotation giving me

Traceback (most recent call last):
  File "/sites/histowiz/SlideRunner/SlideRunner/gui/mouseEvents.py", line 351, in pressImage
    leftClickImage(self,event)
  File "/sites/histowiz/SlideRunner/SlideRunner/gui/mouseEvents.py", line 211, in leftClickImage
    self.ui.annotationsList.append(self.screenToSlide(getMouseEventPosition(self,event)))
AttributeError: 'Ui_MainWindow' object has no attribute 'annotationsList'

But I'll take a look and see what's going on and hopefully get to the bottom of it first. Thanks!

maubreville commented 6 years ago

Should you need any assistance, please let me know!