scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
67 stars 17 forks source link

Parsing non-standard characters in unit name #350

Closed kephale closed 3 years ago

kephale commented 3 years ago

This error came up when I was helping out a user over email:

Started application as PID 21664

This is sciview 0.2.0-beta-9-SNAPSHOT (e597bd7f) ) / scenery 0.7.0-beta-8-SNAPSHOT (5de0b1ee) ( (e597bd7f)  /  (5de0b1ee))

Resetting language to Python

Loaded Deferred Shading (Deferred Shading, with HDR postprocessing and FXAA)

Physical devices: 

  0: Intel Intel(R) UHD Graphics 620 (IntegratedGPU, driver version 0.401.3487, Vulkan API 1.1.127) (selected)

Creating 1 distinct queue groups

Using swapchain SwingSwapchain

Renderer initialisation complete.

No custom key configuration found, using default keybindings.

[INFO] Running InputSetup

[ERROR] Could not read input config from <personal info removed> (The system cannot find the file specified)

Recreating Swapchain at frame 0 (SwingSwapchain)

Selected present mode: VK_PRESENT_MODE_FIFO_KHR with 3 images

Creating render framebuffer GeometryBuffer for pass Scene (604x523)

 + attachment NormalsMaterial, RGBA_Float16

 + attachment DiffuseAlbedo, RGBA_UInt8

 + attachment ZBuffer, Depth32

Creating render framebuffer AOTemp1 for pass AO (604x523)

 + attachment Occlusion, R_UInt8

Creating render framebuffer AOTemp2 for pass AOBlurV (604x523)

 + attachment Occlusion, R_UInt8

Creating render framebuffer AOBuffer for pass AOBlurH (302x261)

 + attachment Occlusion, R_UInt8

Creating render framebuffer ForwardBuffer for pass DeferredLighting (604x523)

 + attachment Color, RGBA_Float16

Creating render framebuffer HDRBuffer for pass ForwardShading (604x523)

 + attachment Color, RGBA_Float16

 + attachment Depth, Depth32

Creating render framebuffer FXAABuffer for pass HDR (604x523)

 + attachment Color, RGBA_UInt8

Scene initialization started.

Scene initialization complete, took 102.23954 ms.

Done initializing SciView

[ERROR] Cannot parse unit: �m

ucar.units.UnitParseException: Specification error: �m

    at ucar.units.StandardUnitFormat.parse(StandardUnitFormat.java:145)

    at ucar.units.UnitFormatImpl.parse(UnitFormatImpl.java:74)

    at net.imagej.units.DefaultUnitService.parseUnit(DefaultUnitService.java:161)

    at net.imagej.units.DefaultUnitService.findConversion(DefaultUnitService.java:131)

    at net.imagej.units.DefaultUnitService.value(DefaultUnitService.java:75)

    at sc.iview.SciView.addVolume(SciView.kt:1130)

    at sc.iview.commands.edit.add.AddVolume.run(AddVolume.kt:81)

    at org.scijava.command.CommandModule.run(CommandModule.java:196)

    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)

    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)

    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)

    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

    at java.lang.Thread.run(Thread.java:748)

Caused by: ucar.units.TokenMgrError: Lexical error at line 1, column 1.  Encountered: "\u00b5" (181), after : ""

    at ucar.units.StandardUnitFormatTokenManager.getNextToken(StandardUnitFormatTokenManager.java:570)

    at ucar.units.StandardUnitFormat.jj_ntk(StandardUnitFormat.java:1693)

    at ucar.units.StandardUnitFormat.unitSpec(StandardUnitFormat.java:456)

    at ucar.units.StandardUnitFormat.parse(StandardUnitFormat.java:140)

    ... 15 more

[ERROR] Module threw exception

java.lang.NullPointerException

    at net.imagej.units.DefaultUnitService.findConversion(DefaultUnitService.java:133)

    at net.imagej.units.DefaultUnitService.value(DefaultUnitService.java:75)

    at sc.iview.SciView.addVolume(SciView.kt:1130)

    at sc.iview.commands.edit.add.AddVolume.run(AddVolume.kt:81)

    at org.scijava.command.CommandModule.run(CommandModule.java:196)

    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)

    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)

    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)

    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

    at java.lang.Thread.run(Thread.java:748)
skalarproduktraum commented 3 years ago

I've seen that one before and it's good to track it here. However this looks like ucar.units getting stuck on Unicode characters, probaly the µ in µm.

skalarproduktraum commented 3 years ago

It also looks like... ahemm, "somebody", has already taken care of this issue: https://github.com/imagej/imagej-common/commit/43590c8e484ccb8c42db21b6f712c353f0fa21b5#diff-50be59f29a0909ae55573c8f8eccf86174372a6eb39b5f31e96a7e9d3d5df92b, but only replaces \u00B5, but not \u00b5 ;)

kephale commented 3 years ago

Ah thanks for catching that. Dunno when I'll get a chance to poke at this, but at least this is straightforward to fix.

skalarproduktraum commented 3 years ago

Took the liberty of fixing this directly as it was very easy: https://github.com/imagej/imagej-common/pull/98

kephale commented 3 years ago

Danke

skalarproduktraum commented 3 years ago

Also taking care of this in sciview now, please open a new issue should this resurface.