CMTK command not found

81 views
Skip to first unread message

George Yerou

unread,
Nov 6, 2020, 7:46:10 AM11/6/20
to nat-user
Dear Dr Jefferis,
I would greatly appreaciated your thoughts on getting CMTK to function.

CMTK on windows generally:
I have set up CMTK on windows. I must have had success as, following the set up, I was able to upload tracings to my local NBLAST in R, whereas - prior to setting up CMTK-  I received "xform error".

I have further tested the install in R as below:

> library(nat);cmtk.dof2mat(version = TRUE)
[1] "3.3.1"
> cmtk.bindir()
[1] "C:\\cygwin64\\usr\\local\\lib\\cmtk\\bin"

However, in Cygwin, if I type cmtk commands eg: dcm2image, registration, reformatx or warp I simply get, "command not found".

CMTK on fiji:
In fiji, when I run the, "install CMTK" (cygwin)  I receive a long error (see bottom of message).

Dragging and dropping the munger.sh  file in the "command" folder generated by fiji returns the following:

$ /cygdrive/c/Users/gyero/Dropbox/WRITE.NEURON/yourregistrationfolder/commands/munger_2020-11-06_12.24.41.sh
/cygdrive/c/Users/gyero/Dropbox/WRITE.NEURON/yourregistrationfolder/commands/munger_2020-11-06_12.24.41.sh: line 3: cd: $'C:\\Users\\gyero\\Dropbox\\WRITE.NEURON\\yourregistrationfolder\r': No such file or directory
/cygdrive/c/Users/gyero/Dropbox/WRITE.NEURON/yourregistrationfolder/commands/munger_2020-11-06_12.24.41.sh: line 4: C:\Users\gyero\DOCUME~1\Fiji.app\bin\cmtk\munger: command not found

I can confirm that: there is a "munger" file under C:\Users\gyero\Documents\Fiji.app\bin\cmtk. - although it has no file extension. 

I have: tried replacing the CMTK folder in the "fiji.app" directory with the cmtk folder from C:\\cygwin64\\usr\\local\\lib\\cmtk\\bin. However this does not seem to work either. Furthermore, I have java JDK, jgo and maven setup on my pc.

I would be very greatful for your thoughts and time!

Alterantively, is there a means of converting an nrrd a filled neuron trace  into an swc which could in turn easily be registered to a new template in R? I have traced a neuron, and used the "fill" function so that the tracing has an accurate axonal diameter. I then save this "filled" tracing as an nrrd, tiff etc. If there was someway to convert thes to swc and preserve the "fill" data it would a convenient way to transform an individual neuron of interest between formats for colourdepth imaging etc.

Best wishes,
George.



INFO] Reading available sites from https://imagej.net/
C:\Users\gyero\DOCUME~1\Fiji.app\bin\cmtk
Downloading CMTK-3.3.1-CYGWIN-x86_64.tar.gz from url http://www.nitrc.org/frs/download.php/9901/CMTK-3.3.1-CYGWIN-x86_64.tar.gz/?i_agree=1&download_now=1 to C:\Users\gyero\DOCUME~1\Fiji.app\bin\cmtk
Downloading http://www.nitrc.org/frs/download.php/9901/CMTK-3.3.1-CYGWIN-x86_64.tar.gz/?i_agree=1&download_now=1 to C:\Users\gyero\AppData\Local\Temp\tmpm7d_9gCMTK-3.3.1-CYGWIN-x86_64.tar.gz
Download size should be 76871769
Downloaded file has size 76871769
Cleaning up!
[ERROR] Traceback (most recent call last):
  File "CMTK_Registration/Install_CMTK.py", line 81, in <module>
  File "__pyclasspath__/cmtkgui$py.class", line 370, in download_and_untar_url
  File "C:\Users\gyero\DOCUME~1\Fiji.app\jars\jython-slim-2.7.2.jar\Lib\tempfile$py.class", line 425, in close
OSError: unlink(): an unknown error occurred: C:\Users\gyero\AppData\Local\Temp\tmpm7d_9gCMTK-3.3.1-CYGWIN-x86_64.tar.gz

at org.python.core.Py.OSError(Py.java:109)
at org.python.modules.posix.PosixModule.unlink(PosixModule.java:1129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:208)
at org.python.core.PyObject.__call__(PyObject.java:477)
at org.python.core.PyObject.__call__(PyObject.java:481)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at tempfile$py.close$23(D:/hg/work/build2/resources/main/Lib/tempfile.py:425)
at tempfile$py.call_function(D:/hg/work/build2/resources/main/Lib/tempfile.py)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
at org.python.core.PyFunction.__call__(PyFunction.java:416)
at org.python.core.PyMethod.__call__(PyMethod.java:126)
at cmtkgui$py.download_and_untar_url$26(C:/Users/gyero/DOCUME~1/Fiji.app/plugins/CMTK_Registration/cmtkgui.py:370)
at cmtkgui$py.call_function(C:/Users/gyero/DOCUME~1/Fiji.app/plugins/CMTK_Registration/cmtkgui.py)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:306)
at org.python.core.PyBaseCode.call(PyBaseCode.java:176)
at org.python.core.PyFunction.__call__(PyFunction.java:449)
at org.python.pycode._pyx0.f$0(CMTK_Registration/Install_CMTK.py:81)
at org.python.pycode._pyx0.call_function(CMTK_Registration/Install_CMTK.py)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1687)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:255)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at org.scijava.script.ScriptModule.run(ScriptModule.java:157)
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: java.nio.file.FileSystemException: C:\Users\gyero\AppData\Local\Temp\tmpm7d_9gCMTK-3.3.1-CYGWIN-x86_64.tar.gz: The process cannot access the file because it is being used by another process.

at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at org.python.modules.posix.PosixModule.unlink(PosixModule.java:1119)
... 41 more



Greg Jefferis

unread,
Nov 6, 2020, 11:28:43 AM11/6/20
to George Yerou, nat-user
Dear George,

1. Check your PATH under Cygwin

2. cmtk has a wrapper script (called cmtk) to run the individual tools (like reformatx). Only the cmtk wrapper script will be in your path. The other ones are in the location returned by cmtk.bindir()

"C:\\cygwin64\\usr\\local\\lib\\cmtk\\bin"

To access the other ones directly you need to specify the full path or add that folder to the Cygwin PATH variable

3. To run your commands/munger_xxx.sh scripts using the Cygwin CMTK, you must edit them to change the -b option which points to the same CMTK binary folder mentioned in the previous point.

4. You can certainly transform your swc files from within nat. It sounds like you are using Fiji's Simple Neurite Tracer. I forget how the "fill" option works. If it changes the radius in the resultant SWC file it will work. If you send me an example including simple neurite tracers default output I can try to remind myself and see if it could work.

All the best,

Greg.


--
You received this message because you are subscribed to the Google Groups "nat-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nat-user+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nat-user/9467766d-5ffb-4fdb-b535-83d2e635d54fo%40googlegroups.com.

gj.y...@gmail.com

unread,
Nov 6, 2020, 11:49:51 AM11/6/20
to Greg Jefferis, nat-user

Dear Dr Jefferis,

 

Thank you for your response. Below is a reminder of the “fill” options on SNT. I can save the filled trace as a grayscale image (nrrd) ,  as a binary mask or a csv . However I can’t see an option to save it as, essentially, a chunky swc trace.

 

Best wishes,

George.

 

image001.jpg

Greg Jefferis

unread,
Nov 6, 2020, 12:00:40 PM11/6/20
to George Yerou, nat-user
Can you provide a sample of the CSV and the binary mask as well as the "simpleneurite tracer" file itself (which is a compressed xml). Best, Greg.

gj.y...@gmail.com

unread,
Nov 6, 2020, 12:54:25 PM11/6/20
to Greg Jefferis, nat-user

Hi,

Here is a link to the dropbox folder with the relevant information: https://www.dropbox.com/sh/t7mskf7dypmj8lw/AABUqyU4PXwRUpPeQpYSKgyOa?dl=0.

It contains the csv, binary mask (as an nrrd), original image (tiff) and the tracing itself saved as a .traces file (I was unsure how to save the trace as a compressed xml as supposed to .swc/.traces). I hope this is sufficient.

Thank you for your time.

 

Best wishes,

George.

 

 

From: Greg Jefferis <jeff...@gmail.com>
Sent: 06 November 2020 17:01
To: George Yerou <gj.y...@gmail.com>
Cc: nat-user <nat-...@googlegroups.com>
Subject: Re: [nat-user] CMTK command not found

 

Can you provide a sample of the CSV and the binary mask as well as the "simpleneurite tracer" file itself (which is a compressed xml). Best, Greg.

Fill.csv

Greg Jefferis

unread,
Nov 8, 2020, 11:55:46 AM11/8/20
to George Yerou, nat-user
Dear George,

You can obtain a 3D mesh representation of your simple neurite tracer objects by activating the 3D viewer while tracing. Then select the object in the viewer:

And choose File … Export Surfaces … Wavefront *while the 3D viewer window is active*.

That gives you an .obj file that can be read into R

nclear3d()
plot3d(fillskel, col='black', lwd=3)
plot3d(fill1, type='wire', col='red')
library(nat.flybrains)
plot3d(T1)



You can then map either the mesh or skeleton data to different template brains using standard procedures. 

library(nat.jrcbrains)
# convert to hemibrain space (µm calibration)
# nb via JFRC2 ensures the best bridging path
fillskel.hbum=xform_brain(fillskel, reference = 'JRCFIB2018F', sample=T1, via=JFRC2)
fill1.hbum=xform_brain(fill1, reference = 'JRCFIB2018F', sample=T1, via=JFRC2)

nclear3d()
plot3d(fillskel.hbum, col='black', lwd=3)
plot3d(fill1.hbum, type='wire', col='red')
library(hemibrainr)
plot3d(hemibrain_microns.surf, alpha=.2, col='grey')


I suspect the bridging registration from T1 (which is at this point a rather old male template brain) may not be as good as some others, but should still allow you to make useful comparisons.

All the best,

Greg.

<Fill.csv>

Reply all
Reply to author
Forward
0 new messages