A set of tools for manipulation of the .nml, .swc, .zip, and .hoc files generated from webKnossos and related software. Used for processing of segmentation and skeletonization data.
There was an Tab Error in the else statement of line 94 of nml2swc.py which caused it to run incorrectly. I believe I have fixed the error, since after making the spacing adjustments, the code ran fine. Here is the corrected version:
nml_merger, as it stands, can only merge WebKnossos files. The old Knossos format is slightly different and won't merge, instead triggering a warning and skipping the file.
The same information is (maybe?) found in the old Knossos files, it just needs to be parsed differently before it can be merged.
As it stands, swc2hoc.py sometimes doesn't terminate. Obviously this needs to be fixed. Documentation is also necessary and should be added to the readme.
swc_corrector.py was removed but should be reinstated and refactored to meet the level of polish that other scripts in this toolkit deliver. My thinking at the time was that integrating it into nml2swc.py would make it unneccessary, but it would still be useful to have as a standalone.
The soma is currently handled in a very naive way. The swc should be reordered and then traversed to write its nodes, not just copied as is from the file.
If multiple branches descend directly from the soma, chaos ensues. The soma is currently treated as a special case but should be treated in the same way as the other branchpoints, except that its branch numbers should have a "d" prepended to them.
These two scripts really belong in the zip_tools directory of this toolkit, but need to be generalized for use by others. Too much hardcoding etc. exists in those scripts at the moment.
In swc2hoc.py, sometimes the hoc code will be generated in such a way that a child section is written before its parent. Attempting to use the comment prefix from the parent leads to issues. Perhaps the best solution is to "sort" the sections in a way that this is forbidden before calling comment.
Given the importance of the axon sections in HOC, it seems like that portion of the code should be generated similarly to the soma and dendrite sections.
I can't get the swc file when using the nml2swc script. I ran it from Spyder (Python version 3.8.5), replacing the first argument of the first function with the path where my .nml file is located. No errors are thrown, yet nothing happens with the nml file.
Passing a directory to hoc_commenter.py should search the directory for .hoc files and comment each of them as a batch. This is already done by some other tools and should be very easy to implement.
Sometime the HocCode produced by swc2hoc.py has giant jumps in it. It looks to me like this is caused by a failure of the TREES Toolbox to find a branchpoint, but more investigation is needed. Debug comment has been added to help remedy this problem manually.