Hi,
I am exploring writing a zscript to import data from an ASCII text file, and build geometry in ZBrush. The data is on neuron structure from research studies, and is in a very basic form where, after some metadata, each line contains:
an index, a structure identifier, x,y,z coordinates, radius, and the index number of the “parent” node
A typical file might look like this:
SWC to SWC conversion from L-Measure.
Original fileName: foo.swc
1 1 27.03 -103.54 -4.15 20.6075 -1
2 1 27.03 -82.93 -4.15 20.6075 1
3 1 27.03 -124.15 -4.15 20.6075 1
4 3 10 -112.5 -14.5 2.6 1
5 3 1.5 -114 -17.5 2.45 4
6 3 -3 -115.5 -21 2.45 5
7 3 -19 -105 -21 0.85 6
8 3 -50.5 -87.5 -28.5 0.85 7
9 3 -119 -53 -52 0.7 8
10 3 -129 -48 -56.5 0.65 9
…
It strikes me that this information maps very well to creating a ZSphere model.
I’ve done this previously in python for another 3D package (https://github.com/NWoolridge/NeuronBuild); python’s string handling is very good, though, and I wasn’t sure whether in zscript I can:
-
count lines in an input text file
-
ignore comment lines (#)
-
traverse lines using space as a delimiter
Please forgive my ignorance, but I haven’t been able to figure this out from the zscript commend reference. Thanks!