neurolabusc / surf-ice

GLSL surface rendering source code. Compiled versions available from NITRC. Loads 3DS, CTM, DXF, FreeSurfer, GII (GIfTI), GTS, LWO2, MS3D, MZ3, NV (BrainNetViewer), OBJ, OFF, PLY, STL, VTK. Tractography formats include BFloat, PDB, TCK, TRK, and VTK. Also NIfTI format voxelwise images.
https://www.nitrc.org/plugins/mwiki/index.php/surfice:MainPage
BSD 2-Clause "Simplified" License
106 stars 23 forks source link

Fix anterior view. #27

Closed ningfei closed 3 years ago

ningfei commented 3 years ago

The anterior view didn't work properly.

Btw, shortcut for posterior view Alt + P doens't work at least on Linux and Windows. Seems a conflict issue.

neurolabusc commented 3 years ago

Can you try the latest commit. I have integrated your fixes. The 'Previous Volume' and "Next Volume" shortcuts have changed to avoid contention. There is also a new "Xray" shader. Finally, there are a few changes to remove ancient unused code and ease compilation, though more work must be done.

ningfei commented 3 years ago

Hi Chris, got an error during compiling:

mainunit.pas(6168,4) Error: (3283) Operator is not overloaded: + "Constant String"
mainunit.pas(6178,38) Error: (3203) Illegal expression

Any clue?

ningfei commented 3 years ago

btw, noticed another issue with bilateral view setting:

  1. Suppose we have three meshes: A.lh.mz3, A.rh.mz3 and B.mz3 (some mesh on the right hemisphere)
  2. Load A.lh.mz3, it will by default load both left and right hemisphere.
  3. Set bilateral setting to show Left only, then close Surf-Ice.
  4. Load B.mz3, nothing will show, since we set the bilateral setting to left only. But the mesh is on the right hemisphere. Besides, there's no menu entry to set back the setting to show both hemishpere, since it's loading a single mesh file instead of bilateral meshes.

I think in such case it would be better to set the view setting back to the default option to show both hemishpere when it detects it's loading a single mesh file. What do you think?

neurolabusc commented 3 years ago

@ningfei I can not replicate your issue on line 6168 with MacOS or Windows with the latest commit of my respository. That code lists the compiler specific options (operating system, widgetset, etc), so it might be nice to know the OS you are using (Linux, Windows, MacOS) and the version of Lazarus. If you are building from the command line (e.g. with LazBuild), what compiler options are you providing?

I have compiled a pre-release of the latest source code:

Can you please test the compiled Windows executable.

I agree that the use of bilateral images gets very confusing. With this release, you must explicitly load them with the File/LoadBilateral menu item or the meshloadbilateral() Python command. The Scripting/Python/Walnut menu item illustrates this.

The FreeSurfer file format is frustrating, names like lh.pial are reused for all subjects and with different numbers of vertices, there is nothing except the file name that reveals whether the mesh belongs to the left or right hemisphere (though I guess you could compute the center of mass for all the vertices, though this does not work for spherical maps). Also, a NIfTI volume can contain data for both hemispheres. Given these constraints, it is hard to develop an intuitive way for loading these images.

ningfei commented 3 years ago

I used lazbuild without any additional parameter lazbuild surfice.lpr on Linux. Latest Lazarus from here: compiler 3.2.0.

For the bilateral view thing, actually I like the previous behavior that it loads both hemispheres by default when I drag into only one hemishpere or when I use the script. Only the bilateral setting need to be reset if only single file (no lh+rh naming pattern exists) is loaded. The current new release seems having new problem now:

  1. Load bilateral meshes, the bilateral setting appears.
  2. Load another single mesh on the right hemisphere, the bilateral menu disappears. Close surfice.
  3. Reopen surfice, the single mesh on the right hemisphere will show again. But the bilateral menu shows now (should not be there).
  4. If you gointo the bilateral menu, and click show Right hemisphere only, the loaded mesh on the right hemishpere disappear.

Sorry for so many troubles!

neurolabusc commented 3 years ago