SwatPhonLab / UltraTrace

A Free/Open-Source tool for manual annotation of Ultrasound Tongue Imaging data.
GNU General Public License v3.0
10 stars 5 forks source link

Does not run on lab Mac #94

Open BartholomaeusAstrum opened 4 years ago

BartholomaeusAstrum commented 4 years ago

Here's what I tried to do, and the error I got:

dhcp-130-58-75-101:UltraTrace nstern1$ python3 -m ultratrace /Volumes/ResearchAssistant/ultrasound/processed.git/P04 
INFO: initializing UltraTrace
INFO:  - initializing module: Data
DEBUG:    - parsing directory: `/Volumes/ResearchAssistant/ultrasound/processed.git/P04`
DEBUG:    - found metadata file: `/Volumes/ResearchAssistant/ultrasound/processed.git/P04/metadata.json`
INFO:  - initializing module: Control
INFO:  - initializing module: Trace
INFO:  - initializing module: Dicom
INFO:  - initializing module: Audio
INFO:  - initializing module: Video
INFO:  - initializing module: TextGrid
ERROR: exception:  name 'E' is not defined
INFO:  - initializing module: Spectrogram
INFO:  - loading widgets
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/__main__.py", line 604, in <module>
    app = App()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/__main__.py", line 86, in __init__
    self.filesUpdate()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/__main__.py", line 501, in filesUpdate
    self.framesUpdate()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/__main__.py", line 543, in framesUpdate
    self.TextGrid.update()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/textgrid.py", line 897, in update
    for itm in self.frames_canvas.find_all():
AttributeError: 'TextGrid' object has no attribute 'frames_canvas'
BartholomaeusAstrum commented 4 years ago

Trying to run on a different directory generates a different error:

dhcp-130-58-75-101:UltraTrace nstern1$ python3 -m ultratrace /Volumes/ResearchAssistant/ultrasound/processed.git/P03 
INFO: initializing UltraTrace
INFO:  - initializing module: Data
DEBUG:    - parsing directory: `/Volumes/ResearchAssistant/ultrasound/processed.git/P03`
DEBUG:    - found metadata file: `/Volumes/ResearchAssistant/ultrasound/processed.git/P03/metadata.json`
INFO:  - initializing module: Control
INFO:  - initializing module: Trace
INFO:  - initializing module: Dicom
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/__main__.py", line 604, in <module>
    app = App()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/__main__.py", line 78, in __init__
    self.Dicom = modules.Dicom(self)
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 47, in __init__
    self.reset()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 148, in reset
    self.methodMenu = OptionMenu(self.frame, self.method, *[x.label for x in READERS[self.mode]], command=self.chooseMethod)
TypeError: __init__() missing 1 required positional argument: 'value'
keggsmurph21 commented 4 years ago

Regarding the first error, it looks like TextGrid::makeFrameWidget was never called, although it's hard to see exactly why without your dataset. You can try to debug that yourself by applying this patch to enter the python debugger when you encounter that error:

PATCH-debug-missing-frames-canvas.txt

$ # download the file, then navigate to the repo and run
$ git apply /path/to/PATCH-debug-missing-frames-canvas.txt

Regarding the second error, that will happen if READERS[self.mode] is an iterable of len() == 0. This is probably because you're in an unrecognized self.mode? Again, difficult to debug without the actual data, but you can try entering the debugger as above :^)

Finally, you can put your stack traces in monospace by putting a line containing ``` (i.e., triple backtick) directly above and below them :^)

jonorthwash commented 4 years ago

I believe this is an issue @mr-martian identified this morning.

@BartholomaeusAstrum, try checking out an earlier commit (git checkout commithash) to get around it until a fix is found.

mr-martian commented 4 years ago

Yeah, I pushed some incomplete changes last night, so probably just stick with 4c54f9d02a74404e6be71d2815abe6d159ea9f64 and I'll finish the file processing stuff in the next few days hopefully.

For the second error, I forgot check what happens if there is neither a dicom nor a ult found.

mr-martian commented 4 years ago

Should be fixed as of 8d7c172.

The issue was ultimately that the textgrid module was calling Metadata.unrelativize multiple times on the same path and thus erroring due to trying to open a non-existent textgrid file.

BartholomaeusAstrum commented 4 years ago

"Extract to PNGs" does not correctly load pre-existing PNGs. Script tries to load from /Volumes/ResearchAssistant/ultrasound/processed.git/P04/dicom/048_dicom_to_png/048_frame_0001.png whereas the files are at /Volumes/ResearchAssistant/ultrasound/processed.git/P04/048_dicom_to_png/048_frame_0001.png

Full trace:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3442, in __call__
    self.__callback(self.__value, *args)
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 94, in chooseMethod
    self.update()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 69, in update
    self.zframe.setImage(self.reader.getFrame(_frame or self.app.frame))
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/util/framereader.py", line 147, in getFrame
    return Image.open(self.png_name % framenum)
  File "/usr/local/lib/python3.7/site-packages/PIL/Image.py", line 2652, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/ResearchAssistant/ultrasound/processed.git/P04/dicom/048_dicom_to_png/048_frame_0001.png'
BartholomaeusAstrum commented 4 years ago

Also received another error when I tried loading a file with already-generated PNGs:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 77, in load
    self.reader.load()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/util/framereader.py", line 121, in load
    info( 'Reading DICOM data ...', end='\r' )
TypeError: info() got an unexpected keyword argument 'end'
kmurphy4 commented 4 years ago

That second one is my fault. I'll submit a patch shortly. Sorry about that!

keggsmurph21 commented 4 years ago

Should be fixed in 5d5c410, @BartholomaeusAstrum can you verify?

mr-martian commented 4 years ago

@BartholomaeusAstrum does 69829bb fix the png location issue?

BartholomaeusAstrum commented 4 years ago

PNG location issue is fixed!

BartholomaeusAstrum commented 4 years ago

Now the program can't create new PNGs. It seems like it's looking for pre-existing ones instead. My attempt to generate PNGs for slide 058 (by selecting "Extract to PNGs") generated the following error:

INFO:   /Volumes/ResearchAssistant/ultrasound/processed.git/P04/dicom/058_dicom_to_png
ERROR:  file /Volumes/ResearchAssistant/ultrasound/processed.git/P04/dicom/058_dicom_to_png/058_frame_0001.png does not exist
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 3442, in __call__
    self.__callback(self.__value, *args)
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 106, in chooseMethod
    self.update()
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/modules/dicom.py", line 69, in update
    self.zframe.setImage(self.reader.getFrame(_frame or self.app.frame))
  File "/Users/nstern1/Desktop/UltraTrace/ultratrace/widgets/zoom_frame.py", line 88, in setImage
    self.width, self.height = self.image.size
AttributeError: 'NoneType' object has no attribute 'size'
BartholomaeusAstrum commented 4 years ago

I also just noticed the following error generated on startup: may be unrelated.

INFO:    - initializing module: Control
INFO:    - initializing module: Trace
INFO:    - initializing module: Dicom
INFO:    - initializing module: Audio
INFO:    - initializing module: Video
INFO:    - initializing module: TextGrid
ERROR:  '_tkinter.tkapp' object has no attribute 'Spectrogram'
INFO:    - initializing module: Spectrogram
INFO:    - loading widgets
BartholomaeusAstrum commented 4 years ago

"Read pixel data" seems to still work