Importing data from ascii format
Posted by DavidOxley2 on Apr 18, 2011; 2:30pm
URL: http://imagej.273.s1.nabble.com/Importing-data-from-ascii-format-tp3684915.html
Dear all,
I have found similar questions to mine, but nothing quite the same. I have very little experience with ImageJ and could not find an answer to my question in the documentation and thought this may be a place to start. If I am in the wrong place, please let me know.
I have two questions:
1) problem importing ascii numbers
I am trying to transfer some data from one software tool to another, where the second requires a 3Dimage file in binary format (unsigned short integers) as its input.
I have a 3D voxel space of 100x100x100 voxels, which I essentially have full control over and can (in theory) write to any format I want (or imageJ needs). ImageJ was recommended to me as being able to load in ascii data and write out the 3D image file.
I have reduced my voxel map to a very simple case of a straight line for debugging purposes. So I export my voxel space into a list of 1 million decimals either 0 or 9:
0
0
0
(...)
9
(...)
0
If I load this into imageJ using File>Import>Raw data.. and set up the formatting (100pixelsx100pixelsx100slices), then I can see my line where I expect it to be. However if I replace the 9's with 10's, the image seems to become a mess and I dont see my line anymore. I am guessing I need to add some space delimiter. I have tried 0,0,0 and 0 "\t" 0 etc, but cant find what is correct.
If anyone can advise me how best to change my format, this will be very helpful.
2) Saving the imported data to 3D image
Let's say I go back to the 9's and I can see my data no problem. Then I want to save it, I have been advised to save it as raw data, unsigned short int in binary format. But using File>Save As> Raw data , seems to just give me a list of integers again, when I need a binary option. Does this exist somewhere?
These feel like basic questions to me, but I could not find what I wanted in the user guide. Perhaps someone can also recommend further documentation.
Many thanks in advance,
Dave