help > RE: Overwrite libtiff in Matlab to run IO toolbox
Aug 9, 2011  02:08 PM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
I have only brainaligner on my Fedora machine and I don't have network connection on it. I would like to do as less as possible on this isolated computer.

So I think I will use ImageJ and write in python to deal with the DF. I have a small problem with the header. What I see on the saveStack2Raw_2byte function is :

long nwrite = fwrite(formatkey, 1, lenkey, fid);
nwrite = fwrite(&endianCodeMachine, 1, 1, fid);
nwrite=fwrite(&dcode, 2, 1, fid);
nwrite = fwrite(mysz, 2, 4, fid);

nwrite = fwrite(img, unitSize, totalUnit, fid);

So the sizes in the header are : 24, 1, 2, 2, 2, 2, 2. Total : 35.
For the loadRaw2Stack I read : 24, 1, 2, 4, 4, 4, 4 Total 43

On a post you mentionned 43 for the header also.

But I do this in python :
try:
    byte=f.read(24)
    print ("a",byte)

    byte = f.read(1)
    print ("b",byte)
   
    byte = f.read(2)
    print ("c",byte)
   
    for i in range(4):
        byte = f.read(4)
        print (i, byte)      
finally:
    f.close()

And I get :
('a', 'raw_image_stack_by_hpeng')
('b', 'L')
('c', '\x04\x00')
('0', '\x00\x04\x00\x00')
('1', ' \x03\x00\x00')
('2', '`\x00\x00\x00')
('3', '\x01\x00\x00\x00')
Am I missing something ?

Then to read the sx values in the file, I suppose they are placed line after line, slice after slice. So that for a  5 x 5 x 2 image, we have the following correspondences :

(0,0,0) -> 0
(1,0,0) -> 1
(2,0,0) -> 2
(0,1,0) -> 5
(0,0,1) -> 25
(4,4,1) -> 49

Is it right ?

Thank you
Best Regards


Thomas

Threaded View

TitleAuthorDate
Fernando Amat Jul 16, 2010
Hanchuan Peng Jul 17, 2010
John Roberts May 24, 2012
Thomas Templier Aug 9, 2011
Hanchuan Peng Aug 9, 2011
RE: Overwrite libtiff in Matlab to run IO toolbox
Thomas Templier Aug 9, 2011
Thomas Templier Aug 10, 2011
Hanchuan Peng Aug 10, 2011
Thomas Templier Aug 10, 2011
Hanchuan Peng Aug 10, 2011
Thomas Templier Aug 10, 2011
Hanchuan Peng Aug 10, 2011
Thomas Templier Aug 10, 2011
Hanchuan Peng Aug 10, 2011
Thomas Templier Aug 10, 2011
Hanchuan Peng Aug 10, 2011
Thomas Templier Aug 10, 2011
Hanchuan Peng Aug 10, 2011
Thomas Templier Aug 11, 2011