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

Ultratrace with AAA-exported file #166

Closed TakayukiNagamine closed 1 year ago

TakayukiNagamine commented 2 years ago

Hello,

It would be great if anybody could help me (a really python novice) with using UltraTrace! I have tried running UltraTrace on a data set (test.zip) that contains an ultrasound file from AAA (.ult), an audio file (.wav) and an annotation TextGrid (containing tiers for 'speaker', 'word' and 'segment'). I'm interested in tracking the tongue movement during the interval in the 'segment' tier.

Having gone through installations of Python 3 and ultratrace as instructed on this GitHub page, the error message below has been returned. The GUI appeared very in a flash but then disappeared. In addition, when I tried using UltraTrace with the 'North Wind and the Sun' example ultrasound data, no ultrasound images were displayed (the area was all grey).

I wasn't even sure if this was a bug or associated with anything I did wrong. It could be a bug, or just be the way data has been arranged. Thanks in advance!

Takayuki Nagamine


INFO:   initializing UltraTrace
INFO:    - initializing module: Data
DEBUG:     - parsing directory: `/Volumes/USB1/unnamed`
DEBUG:     - found metadata file: `/Volumes/USB1/unnamed/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
DEBUG:  generating frames tier for 101
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/__main__.py", line 630, in <module>
    app = App()
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/__main__.py", line 93, in __init__
    self.TextGrid = modules.TextGrid(self)
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/textgrid.py", line 56, in __init__
    self.startup()
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/textgrid.py", line 138, in startup
    self.setup()
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/textgrid.py", line 100, in setup
    self.loadOrGenerate()
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/textgrid.py", line 202, in loadOrGenerate
    self.genFramesTier()
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/textgrid.py", line 207, in genFramesTier
    times = self.app.Dicom.getFrameTimes()
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/dicom.py", line 141, in getFrameTimes
    self.app.Data.unrelativize(self.app.Data.getFileLevel('US.txt')))
  File "/Users/TakayukiNagamine/UltraTrace/ultratrace/modules/metadata.py", line 326, in unrelativize
    return os.path.join(self.path, fil)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py", line 153, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
keggsmurph21 commented 2 years ago

Sorry for the slow reply! I can reproduce this error (thanks for the test data!).

It looks like we're assuming that this US.txt file exists as a sibling of *.ult, but that's not the case. AFAICT, we started making this assumption in a72e87f583876d0677573ae368df8580096e41cc. I'm not very familiar with the "ULT" code, so maybe @mr-martian can help more here.

If I just patch the code to handle the missing file more gracefully, I crash immediately here https://github.com/SwatPhonLab/UltraTrace/blob/627c6a843a48ae30825b53b377ab18f9b8c7991e/ultratrace/util/framereader.py#L190 since neither self.ZeroOffset nor self.PixPerVector are ever defined.. and they never have been defined either (introduced in https://github.com/SwatPhonLab/UltraTrace/commit/f4487708e68c30d81a43163378797eb656d1f547) :thinking:

I wish I could help more, but I think the ULTScanLineReader just needs a little bit of TLC. If you happen to have your data in DICOM format, we might be able to support that a bit more :grin:

mr-martian commented 2 years ago

The problem is that every ULT file I had as an example when writing that code was accompanied by a metadata file containing those 2 numbers. Defaults could perhaps be set, but I have no idea what they should be.

jonorthwash commented 2 years ago

Hi @TakayukiNagamine! My apologies, I'm just seeing this now. I see my colleagues have responded already.

Regarding the NW&S data, you'll need to select how to load it using the menu under the file selector. It should probably default to something, but it currently doesn't.

As far as your data from AAA, I believe there's an option in AAA to export the additional needed data. If you can't get it to make files ending in US.txt, then could you share a screenshot of the export window with the settings you're using?

jonorthwash commented 1 year ago

@TakayukiNagamine, please feel free to be in touch or reopen if you continue to have issues.

TakayukiNagamine commented 1 year ago

Hello all, many apologies for my slow reply as well! Been quite busy from actually obtaining ultrasound data with participants for the past few months. Will try out the solutions you've provided and reopen if necessary. Thanks!