help > Overwrite libtiff in Matlab to run IO toolbox
Showing 1-19 of 19 posts
Display:
Results per page:
Jul 16, 2010  06:07 PM | Fernando Amat
Overwrite libtiff in Matlab to run IO toolbox
Hi,
I installed the V3D Matlab IO toolbox and compiled the MEX files. However, when I try to run it Matlab complains of two libraries clashing: libtiff from Matlab itself and libtiff I installed in /usr/local/lib

I am using Mac OS 64 bit. I would like to know how to tell Matlab to llok for libtiff in /usr/local/lib instead of th eother one.

Thanks,
Fernando
Jul 17, 2010  01:07 AM | Hanchuan Peng
RE: Overwrite libtiff in Matlab to run IO toolbox
Let's use the Mac/Linux version(s) of Matlab as the example. What you can do is to disable the default libtiff in Matlab, and instead make it point to the good libtiff of the correct version.

Assume you have already installed libtiff under /usr/local/lib.

Then what you can do is to go to /Path-to-matlab/bin/maci (or maci64 or similar folder for a linux system), and list all *libtiff* files. And then rename or remove the original "libtiff.3.dylib" file. Then you can create a symbolic link to the correct one in the /usr/local/lib folder.

Then it should work (w/o need to re-start Matlab).

-hanchuan


--
====================================

Hanchuan Peng, Ph.D.,
Janelia Farm Research Campus
Howard Hughes Medical Institute
19700 Helix Drive,
Ashburn, VA, 20147, USA.
Tel: (+1) 571-209-4156
Fax: (+1) 571-209-4933
Email: pengh@janelia.hhmi.org

* Peng Lab: http://penglab.janelia.org

* V3D lets you explore & understand your
large 3D/4D/5D images a lot easier!
- fast 3D+ image visualization and analysis,
WYSIWYG, and easy plugin interface:
http://penglab.janelia.org/proj/v3d




Originally posted by Fernando Amat:
Hi,
I installed the V3D Matlab IO toolbox and compiled the MEX files. However, when I try to run it Matlab complains of two libraries clashing: libtiff from Matlab itself and libtiff I installed in /usr/local/lib

I am using Mac OS 64 bit. I would like to know how to tell Matlab to llok for libtiff in /usr/local/lib instead of th eother one.

Thanks,
Fernando[/userquote]
Aug 9, 2011  11:08 AM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
Hello,

I'd like also to use the V3D IO toolbox and have the libtiff problem (windows 7)

I get the message when compiling the mex files :
>> makeosmex_rawfile_io
loadRaw2Stack_c.cpp
loadRaw2Stack_c.cpp(20) : fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
 
  C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Compile of 'loadRaw2Stack_c.cpp' failed.
 
??? Error using ==> mex at 208
Unable to complete successfully.

Error in ==> makeosmex_rawfile_io at 8
mex loadRaw2Stack_c.cpp mg_image_lib.cpp mg_utilities.cpp -ltiff

The libtiff version I have is :
>> versionString = Tiff.getVersion()

versionString =

LIBTIFF, Version 3.7.1
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.

So I've downloaded the 3.8.2 from sourceforge and installed it. http://sourceforge.net/projects/gnuwin32...

In my matlab/bin/ I have the file libtiff.dll  (so no libtiff.3.dylib)
In the libtiff I've just installed I have libtiff3.dll

I've tried to remove the old and replace with the old : no success.
I've tried to remove the old and set the path of matlab to the new one : no success.

Could someone tell me what I should do ?  (I have read the explanation but I have no experience with symbolic links on windows, but there is another way with setting the path in matlab)

Thank You
Best Regards
Thomas
Aug 9, 2011  12:08 PM | Hanchuan Peng
RE: Overwrite libtiff in Matlab to run IO toolbox
on Windows you can use mingw or some other compilers.

mingw itself is 32bit, we have not tested any 64bit mingw variants so far.

why not simply use Matlab on a Linux or Mac system? since we don't release BrainAligner for Windows, and you could produce the displacement files, it seems you do have such OSs.

-hanchuan

Originally posted by Thomas Templier:
Hello,

I'd like also to use the V3D IO toolbox and have the libtiff problem (windows 7)

I get the message when compiling the mex files :
>> makeosmex_rawfile_io
loadRaw2Stack_c.cpp
loadRaw2Stack_c.cpp(20) : fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
 
  C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: Compile of 'loadRaw2Stack_c.cpp' failed.
 
??? Error using ==> mex at 208
Unable to complete successfully.

Error in ==> makeosmex_rawfile_io at 8
mex loadRaw2Stack_c.cpp mg_image_lib.cpp mg_utilities.cpp -ltiff

The libtiff version I have is :
>> versionString = Tiff.getVersion()

versionString =

LIBTIFF, Version 3.7.1
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.

So I've downloaded the 3.8.2 from sourceforge and installed it. http://sourceforge.net/projects/gnuwin32...

In my matlab/bin/ I have the file libtiff.dll  (so no libtiff.3.dylib)
In the libtiff I've just installed I have libtiff3.dll

I've tried to remove the old and replace with the old : no success.
I've tried to remove the old and set the path of matlab to the new one : no success.

Could someone tell me what I should do ?  (I have read the explanation but I have no experience with symbolic links on windows, but there is another way with setting the path in matlab)

Thank You
Best Regards
Thomas
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
Aug 10, 2011  09:08 AM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
I've opened several DF in V3D and they are all the same. Rather dark at the beginning of the stack and bright at the end, and a jump in the last slices. It seems that there might be a small offset somewhere in the header maybe. What do you think of it ?

You said that it is saved in 32 bit float, it means packed in packets of 32 bytes right ?

Best Regards

Thomas
Aug 10, 2011  11:08 AM | Hanchuan Peng
RE: Overwrite libtiff in Matlab to run IO toolbox
the displacement fields for separate direction cannpt be all the same (unless the input data do not have any deformation).

You can tryto add a "-F test1" string in my example program on the web page. You should have three output files. If you load them in V3D, you will see them all different.

-hanchuan



Originally posted by Thomas Templier:
I've opened several DF in V3D and they are all the same. Rather dark at the beginning of the stack and bright at the end, and a jump in the last slices. It seems that there might be a small offset somewhere in the header maybe. What do you think of it ?

You said that it is saved in 32 bit float, it means packed in packets of 32 bytes right ?

Best Regards

Thomas
Aug 10, 2011  01:08 PM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
Hum, it's annoying. I've tested the images on the website with the option -F test1 and I notice the same things. It outputed these files :
total 128452
-rwxrwxr-x. 1 templier templier  2449948 Aug 10 14:44 brainaligner
-rwxrwxr-x. 1 templier templier     1589 Aug 10 14:45 test1_256.marker
-rwxrwxr-x. 1 templier templier  7098416 Aug 10 14:45 test1_256.tif
-rwxrwxr-x. 1 templier templier  7098416 Aug 10 14:45 test2_256.tif
-rw-rw-r--. 1 templier templier  7077931 Aug 10 15:09 test1target.raw
-rw-rw-r--. 1 templier templier      336 Aug 10 15:10 t21_256.tif_target.csv
-rw-rw-r--. 1 templier templier      333 Aug 10 15:10 t21_256.tif_subject.csv
-rw-rw-r--. 1 templier templier       54 Aug 10 15:10 t21_256.tif_matching_quality.csv
-rw-rw-r--. 1 templier templier 33554475 Aug 10 15:10 test1_999_DF_sx.v3draw
-rw-rw-r--. 1 templier templier 33554475 Aug 10 15:10 test1_999_DF_sy.v3draw
-rw-rw-r--. 1 templier templier 33554475 Aug 10 15:10 test1_999_DF_sz.v3draw
-rw-rw-r--. 1 templier templier  7098416 Aug 10 15:10 t21_256.tif
If I drag&drop the DF files into V3D, it says "The file does not exist!" Do nothing. So I make File>Import>Import general image series with the default options (1,1,1, no pattern and Pack images in Z dimension). It gives me the screenshot on the attached file. They have exactly the same values.

Strange things : in the log, it says that the files are not in tif format, but they are, and it outputs the file test1target.raw. The names of the DF files seem weird also (why 999 ?)

The command I've used is :

./brainaligner -t test1_256.tif -s test2_256.tif -L test1_256.marker -w 10 -o t21_256.tif -F test1

Is it normal or there is something wrong ?
Best Regards and thanks for the help.

Thomas


The log of BrainAligner is :
The current input file has the surfix [tif]
#original slice=108 original rez=1.00000 -> #output slices=108 new rez=1.00000
The current input file has the surfix [tif]
#original slice=108 original rez=1.00000 -> #output slices=108 new rez=1.00000
After preprocessing:
 Size of subject_image = [256 256 108 1], size of target_image = [256 256 108 1].

-------------------------------------------------
***BrainAligner [version=0.942] parameters:
Target   file: [test1_256.tif]
Target    rez: [1.0000][1.0000][1.0000]
Ref chanl tgt: [0]
Landmark tgt:  [test1_256.marker]
Subject  file: [test2_256.tif]
Subject   rez: [1.0000][1.0000][1.0000]
Warp res file: [t21_256.tif]
Warp img size: [512]
Ref chanl sbj: [0]
Landmark sbj:  [(null)]
Align G/L type: [Local]
Hierarchical landmark search level: [1]
Landmark matching method: [1]
Displacement field producing method: [3]
Use nearest neighbor interpolation method: [0]
Displacement field file: [test1]
Convert to UINT8 for processing: [No]
Resample to pixel size 0.58um for processing: [No]
Volume change map file: [(null)]
Target copy channel (for attaching mask): [-1]
Subject paste channel (for attaching mask): [-1]
Verbose print: [0]
---------------------------------------------------

********************* target=uint8 subject=uint8
in setInitData(), the target image data normalizer=255.000
The current input file has the surfix [raw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
in setInitData(), the subject image data normalizer=255.000
Done: data initilization.
Read 65 predefined control points from the file. Thus will not invoke the automatic control point detection.
target coord[0]=[87,    138,    43] around subject [87,    138,    43]:     target [43][138][87] -> subject[49][122][87]
target coord[1]=[2,    148,    31] around subject [2,    148,    31]:     ...... not added due to inconsistency of various matching scores.
target coord[2]=[6,    80,    33] around subject [6,    80,    33]:     ...... not added due to inconsistency of various matching scores.
target coord[3]=[68,    58,    56] around subject [68,    58,    56]:     target [56][58][68] -> subject[66][58][72]
target coord[4]=[121,    203,    67] around subject [121,    203,    67]:     target [67][203][121] -> subject[71][198][111]
target coord[5]=[226,    145,    67] around subject [226,    145,    67]:     ...... not added due to inconsistency of various matching scores.
target coord[6]=[87,    184,    20] around subject [87,    184,    20]:     ...... not added due to inconsistency of various matching scores.
target coord[7]=[151,    96,    72] around subject [151,    96,    72]:     target [72][96][151] -> subject[77][103][159]
target coord[8]=[23,    108,    25] around subject [23,    108,    25]:     ...... not added due to inconsistency of various matching scores.
target coord[9]=[49,    198,    40] around subject [49,    198,    40]:     target [40][198][49] -> subject[40][179][43]
target coord[10]=[121,    145,    26] around subject [121,    145,    26]:     ...... not added due to inconsistency of various matching scores.
target coord[11]=[31,    112,    40] around subject [31,    112,    40]:     ...... not added due to inconsistency of various matching scores.
target coord[12]=[29,    70,    63] around subject [29,    70,    63]:     target [63][70][29] -> subject[69][60][27]
target coord[13]=[86,    230,    58] around subject [86,    230,    58]:     target [58][230][86] -> subject[57][219][85]
target coord[14]=[6,    142,    77] around subject [6,    142,    77]:     target [77][142][6] -> subject[81][136][1]
target coord[15]=[166,    197,    34] around subject [166,    197,    34]:     target [34][197][166] -> subject[35][188][162]
target coord[16]=[78,    85,    34] around subject [78,    85,    34]:     target [34][85][78] -> subject[43][84][84]
target coord[17]=[198,    81,    69] around subject [198,    81,    69]:     target [69][81][198] -> subject[73][79][201]
target coord[18]=[13,    240,    55] around subject [13,    240,    55]:     ...... not added due to inconsistency of various matching scores.
target coord[19]=[89,    170,    44] around subject [89,    170,    44]:     target [44][170][89] -> subject[48][152][88]
target coord[20]=[69,    123,    46] around subject [69,    123,    46]:     target [46][123][69] -> subject[52][108][71]
target coord[21]=[76,    125,    36] around subject [76,    125,    36]:     ...... not added due to inconsistency of various matching scores.
target coord[22]=[31,    116,    39] around subject [31,    116,    39]:     ...... not added due to inconsistency of various matching scores.
target coord[23]=[170,    200,    36] around subject [170,    200,    36]:     ...... not added due to inconsistency of various matching scores.
target coord[24]=[77,    84,    36] around subject [77,    84,    36]:     ...... not added due to inconsistency of various matching scores.
target coord[25]=[74,    82,    74] around subject [74,    82,    74]:     target [74][82][74] -> subject[84][81][77]
target coord[26]=[147,    208,    74] around subject [147,    208,    74]:     target [74][208][147] -> subject[77][204][138]
target coord[27]=[60,    113,    74] around subject [60,    113,    74]:     target [74][113][60] -> subject[83][114][60]
target coord[28]=[66,    63,    53] around subject [66,    63,    53]:     target [53][63][66] -> subject[63][62][71]
target coord[29]=[197,    195,    59] around subject [197,    195,    59]:     target [59][195][197] -> subject[61][188][190]
target coord[30]=[137,    206,    59] around subject [137,    206,    59]:     target [59][206][137] -> subject[64][199][128]
target coord[31]=[172,    202,    59] around subject [172,    202,    59]:     target [59][202][172] -> subject[63][197][168]
target coord[32]=[104,    191,    77] around subject [104,    191,    77]:     ...... not added due to inconsistency of various matching scores.
target coord[33]=[83,    152,    81] around subject [83,    152,    81]:     ...... not added due to inconsistency of various matching scores.
target coord[34]=[76,    169,    81] around subject [76,    169,    81]:     target [81][169][76] -> subject[85][164][67]
target coord[35]=[46,    179,    76] around subject [46,    179,    76]:     ...... not added due to inconsistency of various matching scores.
target coord[36]=[89,    145,    49] around subject [89,    145,    49]:     target [49][145][89] -> subject[55][125][87]
target coord[37]=[73,    146,    49] around subject [73,    146,    49]:     ...... not added due to inconsistency of various matching scores.
target coord[38]=[30,    73,    55] around subject [30,    73,    55]:     ...... not added due to inconsistency of various matching scores.
target coord[39]=[12,    147,    38] around subject [12,    147,    38]:     target [38][147][12] -> subject[36][141][8]
target coord[40]=[48,    197,    39] around subject [48,    197,    39]:     target [39][197][48] -> subject[38][178][41]
target coord[41]=[48,    221,    39] around subject [48,    221,    39]:     target [39][221][48] -> subject[42][208][47]
target coord[42]=[12,    214,    39] around subject [12,    214,    39]:     ...... not added due to inconsistency of various matching scores.
target coord[43]=[34,    235,    39] around subject [34,    235,    39]:     ...... not added due to inconsistency of various matching scores.
target coord[44]=[47,    116,    54] around subject [47,    116,    54]:     target [54][116][47] -> subject[58][105][40]
target coord[45]=[42,    221,    54] around subject [42,    221,    54]:     target [54][221][42] -> subject[54][212][39]
target coord[46]=[11,    148,    54] around subject [11,    148,    54]:     target [54][148][11] -> subject[54][142][7]
target coord[47]=[77,    176,    54] around subject [77,    176,    54]:     ...... not added due to inconsistency of various matching scores.
target coord[48]=[27,    205,    54] around subject [27,    205,    54]:     target [54][205][27] -> subject[53][197][22]
target coord[49]=[84,    238,    54] around subject [84,    238,    54]:     ...... not added due to inconsistency of various matching scores.
target coord[50]=[92,    112,    45] around subject [92,    112,    45]:     target [45][112][92] -> subject[53][111][99]
target coord[51]=[137,    184,    45] around subject [137,    184,    45]:     target [45][184][137] -> subject[50][176][128]
target coord[52]=[121,    189,    45] around subject [121,    189,    45]:     ...... not added due to inconsistency of various matching scores.
target coord[53]=[178,    135,    71] around subject [178,    135,    71]:     ...... not added due to inconsistency of various matching scores.
target coord[54]=[178,    183,    69] around subject [178,    183,    69]:     ...... not added due to inconsistency of various matching scores.
target coord[55]=[81,    156,    26] around subject [81,    156,    26]:     ...... not added due to inconsistency of various matching scores.
target coord[56]=[30,    191,    26] around subject [30,    191,    26]:     ...... not added due to inconsistency of various matching scores.
target coord[57]=[33,    234,    26] around subject [33,    234,    26]:     target [26][234][33] -> subject[17][238][13]
target coord[58]=[13,    179,    26] around subject [13,    179,    26]:     target [26][179][13] -> subject[17][161][2]
target coord[59]=[29,    146,    22] around subject [29,    146,    22]:     ...... not added due to inconsistency of various matching scores.
target coord[60]=[18,    226,    18] around subject [18,    226,    18]:     ...... not added due to inconsistency of various matching scores.
target coord[61]=[9,    185,    12] around subject [9,    185,    12]:     target [12][185][9] -> subject[4][169][3]
target coord[62]=[13,    231,    12] around subject [13,    231,    12]:     target [12][231][13] -> subject[4][228][0]
target coord[63]=[23,    107,    29] around subject [23,    107,    29]:     ...... not added due to inconsistency of various matching scores.
target coord[64]=[71,    124,    29] around subject [71,    124,    29]:     target [29][124][71] -> subject[19][138][76]
(1). normalize the point cloud
(2). estimate the initial affine matrix from initial matching using RANSAC

       0,
    (   0). err_invp_min=5.313598
   
    (   3). err_invp_min=5.036110
       5,
    (   9). err_invp_min=4.519104
      10,  15,  20,  25,
    (  29). err_invp_min=4.481841
      30,  35,  40,
    (  43). err_invp_min=4.087120
      45,
      50,  55,
    (  56). err_invp_min=3.705978
      60,  65,  70,  75,  80,  85,
    (  88). err_invp_min=3.688620
      90,  95,
     100, 105, 110, 115, 120, 125, 130, 135, 140, 145,
     150, 155, 160, 165, 170, 175, 180, 185, 190, 195,
     200, 205, 210, 215, 220, 225, 230, 235, 240, 245,
     250, 255, 260, 265, 270, 275, 280, 285, 290, 295,
     300, 305, 310, 315, 320, 325, 330, 335, 340, 345,
     350, 355, 360, 365, 370, 375, 380,
    ( 381). err_invp_min=3.660280
     385, 390, 395,
     400, 405, 410, 415, 420, 425, 430, 435, 440, 445,
     450, 455, 460, 465, 470, 475, 480, 485, 490, 495,
     500, 505, 510, 515, 520, 525, 530, 535, 540, 545,
     550, 555, 560, 565, 570, 575, 580, 585, 590, 595,
     600, 605, 610, 615, 620, 625, 630, 635, 640, 645,
     650, 655, 660, 665, 670, 675, 680, 685, 690, 695,
     700, 705, 710, 715, 720, 725, 730, 735, 740, 745,
     750, 755, 760, 765, 770, 775, 780, 785, 790, 795,
     800, 805, 810, 815, 820, 825, 830, 835, 840, 845,
     850, 855, 860, 865, 870, 875, 880, 885, 890, 895,
     900, 905, 910, 915, 920, 925, 930, 935, 940, 945,
     950, 955, 960, 965, 970, 975, 980, 985, 990, 995,
(3). kill the wrong matches by comparing the distance between A and the corresponding B_invp
(4). de-normalization and get arr_2_invp!
    kill 4 pairs, 32 pairs left!
angle12=12.064 [tedge len=23.622 e1=24.434, e2=46.957]  - drop this plane
angle13=8.083 [tedge len=6.164 e1=41.400, e2=38.962]  - drop this plane
angle13=6.596 [tedge len=6.164 e1=36.235, e2=31.448]  - drop this plane
angle13=11.578 [tedge len=6.164 e1=30.594, e2=29.428]  - drop this plane
angle13=1.975 [tedge len=1.732 e1=48.990, e2=49.346]  - drop this plane
angle12=3.519 [tedge len=1.732 e1=24.000, e2=23.043]  - drop this plane
angle12=2.685 [tedge len=1.732 e1=28.931, e2=27.821]  - drop this plane
angle12=3.675 [tedge len=1.732 e1=27.019, e2=27.000]  - drop this plane
angle12=0.907 [tedge len=1.732 e1=41.449, e2=43.046]  - drop this plane
angle12=160.162 [tedge len=39.774 e1=16.062, e2=24.290]  - drop this plane
angle13=18.892 [tedge len=16.062 e1=49.417, e2=48.166]  - drop this plane
angle23=14.836 [tedge len=15.748 e1=46.141, e2=34.191]  - drop this plane
angle23=17.702 [tedge len=15.748 e1=48.929, e2=41.449]  - drop this plane
angle23=16.322 [tedge len=15.748 e1=49.880, e2=40.694]  - drop this plane
=============================
cc[1]=13.548     target=[87,138,43] subject=[87,122,49]
cc[2]=6.050     target=[68,58,56] subject=[72,58,66]
cc[3]=24.096     target=[121,203,67] subject=[111,198,71]
cc[4]=46.566     target=[151,96,72] subject=[159,103,77]
cc[5]=31.145     target=[49,198,40] subject=[43,179,40]
cc[6]=43.801     target=[29,70,63] subject=[27,60,69]
cc[7]=9.623     target=[86,230,58] subject=[85,219,57]
cc[8]=29.279     target=[6,142,77] subject=[1,136,81]
cc[9]=39.209     target=[166,197,34] subject=[162,188,35]
cc[10]=0.000     target=[78,85,34] subject=[84,84,43]
cc[11]=76.491     target=[198,81,69] subject=[201,79,73]
cc[12]=13.102     target=[89,170,44] subject=[88,152,48]
cc[13]=15.982     target=[69,123,46] subject=[71,108,52]
cc[14]=40.400     target=[74,82,74] subject=[77,81,84]
cc[15]=31.833     target=[147,208,74] subject=[138,204,77]
cc[16]=0.000     target=[60,113,74] subject=[60,114,83]
cc[17]=7.052     target=[66,63,53] subject=[71,62,63]
cc[18]=48.946     target=[197,195,59] subject=[190,188,61]
cc[19]=25.529     target=[137,206,59] subject=[128,199,64]
cc[20]=42.054     target=[172,202,59] subject=[168,197,63]
cc[21]=0.000     target=[76,169,81] subject=[67,164,85]
cc[22]=50.794     target=[12,147,38] subject=[8,141,36]
cc[23]=30.009     target=[48,197,39] subject=[41,178,38]
cc[24]=51.661     target=[48,221,39] subject=[47,208,42]
cc[25]=20.506     target=[47,116,54] subject=[40,105,58]
cc[26]=50.273     target=[42,221,54] subject=[39,212,54]
cc[27]=21.883     target=[11,148,54] subject=[7,142,54]
cc[28]=44.135     target=[27,205,54] subject=[22,197,53]
cc[29]=8.767     target=[92,112,45] subject=[99,111,53]
cc[30]=31.467     target=[137,184,45] subject=[128,176,50]
cc[31]=71.150     target=[13,179,26] subject=[2,161,17]
cc[32]=90.935     target=[9,185,12] subject=[3,169,4]
Overall mean=31.759      std=22.562
-------------------- Finished detecting the best matching points. Now compute displacement field. -------

Prepare save the matching quality record file [t21_256.tif_matching_quality.csv]
method_inconsistency= 0.5077,    model_violation=31.7590
Now save to matching point file of subject to [t21_256.tif_subject.csv]
Now save to matching point file of target to [t21_256.tif_target.csv]

---------------------------------
n=0     x=[87.000 -> 87.000] y=[138.000 -> 122.000] z=[43.000 -> 49.000]
n=1     x=[68.000 -> 72.000] y=[58.000 -> 58.000] z=[56.000 -> 66.000]
n=2     x=[121.000 -> 111.000] y=[203.000 -> 198.000] z=[67.000 -> 71.000]
n=3     x=[151.000 -> 159.000] y=[96.000 -> 103.000] z=[72.000 -> 77.000]
n=4     x=[49.000 -> 43.000] y=[198.000 -> 179.000] z=[40.000 -> 40.000]
n=5     x=[29.000 -> 27.000] y=[70.000 -> 60.000] z=[63.000 -> 69.000]
n=6     x=[86.000 -> 85.000] y=[230.000 -> 219.000] z=[58.000 -> 57.000]
n=7     x=[6.000 -> 1.000] y=[142.000 -> 136.000] z=[77.000 -> 81.000]
n=8     x=[166.000 -> 162.000] y=[197.000 -> 188.000] z=[34.000 -> 35.000]
n=9     x=[78.000 -> 84.000] y=[85.000 -> 84.000] z=[34.000 -> 43.000]
n=10     x=[198.000 -> 201.000] y=[81.000 -> 79.000] z=[69.000 -> 73.000]
n=11     x=[89.000 -> 88.000] y=[170.000 -> 152.000] z=[44.000 -> 48.000]
n=12     x=[69.000 -> 71.000] y=[123.000 -> 108.000] z=[46.000 -> 52.000]
n=13     x=[74.000 -> 77.000] y=[82.000 -> 81.000] z=[74.000 -> 84.000]
n=14     x=[147.000 -> 138.000] y=[208.000 -> 204.000] z=[74.000 -> 77.000]
n=15     x=[60.000 -> 60.000] y=[113.000 -> 114.000] z=[74.000 -> 83.000]
n=16     x=[66.000 -> 71.000] y=[63.000 -> 62.000] z=[53.000 -> 63.000]
n=17     x=[197.000 -> 190.000] y=[195.000 -> 188.000] z=[59.000 -> 61.000]
n=18     x=[137.000 -> 128.000] y=[206.000 -> 199.000] z=[59.000 -> 64.000]
n=19     x=[172.000 -> 168.000] y=[202.000 -> 197.000] z=[59.000 -> 63.000]
n=20     x=[76.000 -> 67.000] y=[169.000 -> 164.000] z=[81.000 -> 85.000]
n=21     x=[12.000 -> 8.000] y=[147.000 -> 141.000] z=[38.000 -> 36.000]
n=22     x=[48.000 -> 41.000] y=[197.000 -> 178.000] z=[39.000 -> 38.000]
n=23     x=[48.000 -> 47.000] y=[221.000 -> 208.000] z=[39.000 -> 42.000]
n=24     x=[47.000 -> 40.000] y=[116.000 -> 105.000] z=[54.000 -> 58.000]
n=25     x=[42.000 -> 39.000] y=[221.000 -> 212.000] z=[54.000 -> 54.000]
n=26     x=[11.000 -> 7.000] y=[148.000 -> 142.000] z=[54.000 -> 54.000]
n=27     x=[27.000 -> 22.000] y=[205.000 -> 197.000] z=[54.000 -> 53.000]
n=28     x=[92.000 -> 99.000] y=[112.000 -> 111.000] z=[45.000 -> 53.000]
n=29     x=[137.000 -> 128.000] y=[184.000 -> 176.000] z=[45.000 -> 50.000]
n=30     x=[13.000 -> 2.000] y=[179.000 -> 161.000] z=[26.000 -> 17.000]
n=31     x=[9.000 -> 3.000] y=[185.000 -> 169.000] z=[12.000 -> 4.000]

#################################
-------------------- Now compute the distances of pixels to the mapping points. -------

z=0 z=1 z=2 z=3 z=4 z=5 z=6 z=7 z=8 z=9 z=10 z=11 z=12 z=13 z=14 z=15 z=16 z=17 z=18 z=19 z=20 z=21 z=22 z=23 z=24 z=25 z=26 z=27 z=28 z=29 z=30 z=31 z=32
-------------------- Now interpolate the DF using linear method. -------

in ApplyDFToChannel(), the subject image data normalizer=255.000
Finish warping the 0th channel.
Done: warping.
Succeed to warp using the DF to the specified channel(s).
The current input file has the surfix [v3draw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
Succeed to save to file test1_999_DF_sx.v3draw
The current input file has the surfix [v3draw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
Succeed to save to file test1_999_DF_sy.v3draw
The current input file has the surfix [v3draw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
Succeed to save to file test1_999_DF_sz.v3draw
Now save the output/warped image [pointer=0x811d250] datatype_warped=1 sz_warped=[256, 256, 108, 1]
The current input file has the surfix [tif]
The warped image has been saved to the file [t21_256.tif].



Originally posted by Hanchuan Peng:
the displacement fields for separate direction cannpt be all the same (unless the input data do not have any deformation).

You can tryto add a "-F test1" string in my example program on the web page. You should have three output files. If you load them in V3D, you will see them all different.

-hanchuan



Originally posted by Thomas Templier:
I've opened several DF in V3D and they are all the same. Rather dark at the beginning of the stack and bright at the end, and a jump in the last slices. It seems that there might be a small offset somewhere in the header maybe. What do you think of it ?

You said that it is saved in 32 bit float, it means packed in packets of 32 bytes right ?

Best Regards

Thomas
Attachment: DF.png
Aug 10, 2011  05:08 PM | Hanchuan Peng
RE: Overwrite libtiff in Matlab to run IO toolbox
attached is my screen-shot of the three files, which are quite different...(which is what I believe to be correct) I am not sure what happened at your end...
-hanchuan

Originally posted by Thomas Templier:
Hum, it's annoying. I've tested the images on the website with the option -F test1 and I notice the same things. It outputed these files :
total 128452
-rwxrwxr-x. 1 templier templier  2449948 Aug 10 14:44 brainaligner
-rwxrwxr-x. 1 templier templier     1589 Aug 10 14:45 test1_256.marker
-rwxrwxr-x. 1 templier templier  7098416 Aug 10 14:45 test1_256.tif
-rwxrwxr-x. 1 templier templier  7098416 Aug 10 14:45 test2_256.tif
-rw-rw-r--. 1 templier templier  7077931 Aug 10 15:09 test1target.raw
-rw-rw-r--. 1 templier templier      336 Aug 10 15:10 t21_256.tif_target.csv
-rw-rw-r--. 1 templier templier      333 Aug 10 15:10 t21_256.tif_subject.csv
-rw-rw-r--. 1 templier templier       54 Aug 10 15:10 t21_256.tif_matching_quality.csv
-rw-rw-r--. 1 templier templier 33554475 Aug 10 15:10 test1_999_DF_sx.v3draw
-rw-rw-r--. 1 templier templier 33554475 Aug 10 15:10 test1_999_DF_sy.v3draw
-rw-rw-r--. 1 templier templier 33554475 Aug 10 15:10 test1_999_DF_sz.v3draw
-rw-rw-r--. 1 templier templier  7098416 Aug 10 15:10 t21_256.tif
If I drag&drop the DF files into V3D, it says "The file does not exist!" Do nothing. So I make File>Import>Import general image series with the default options (1,1,1, no pattern and Pack images in Z dimension). It gives me the screenshot on the attached file. They have exactly the same values.

Strange things : in the log, it says that the files are not in tif format, but they are, and it outputs the file test1target.raw. The names of the DF files seem weird also (why 999 ?)

The command I've used is :

./brainaligner -t test1_256.tif -s test2_256.tif -L test1_256.marker -w 10 -o t21_256.tif -F test1

Is it normal or there is something wrong ?
Best Regards and thanks for the help.

Thomas


The log of BrainAligner is :
The current input file has the surfix [tif]
#original slice=108 original rez=1.00000 -> #output slices=108 new rez=1.00000
The current input file has the surfix [tif]
#original slice=108 original rez=1.00000 -> #output slices=108 new rez=1.00000
After preprocessing:
 Size of subject_image = [256 256 108 1], size of target_image = [256 256 108 1].

-------------------------------------------------
***BrainAligner [version=0.942] parameters:
Target   file: [test1_256.tif]
Target    rez: [1.0000][1.0000][1.0000]
Ref chanl tgt: [0]
Landmark tgt:  [test1_256.marker]
Subject  file: [test2_256.tif]
Subject   rez: [1.0000][1.0000][1.0000]
Warp res file: [t21_256.tif]
Warp img size: [512]
Ref chanl sbj: [0]
Landmark sbj:  [(null)]
Align G/L type: [Local]
Hierarchical landmark search level: [1]
Landmark matching method: [1]
Displacement field producing method: [3]
Use nearest neighbor interpolation method: [0]
Displacement field file: [test1]
Convert to UINT8 for processing: [No]
Resample to pixel size 0.58um for processing: [No]
Volume change map file: [(null)]
Target copy channel (for attaching mask): [-1]
Subject paste channel (for attaching mask): [-1]
Verbose print: [0]
---------------------------------------------------

********************* target=uint8 subject=uint8
in setInitData(), the target image data normalizer=255.000
The current input file has the surfix [raw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
in setInitData(), the subject image data normalizer=255.000
Done: data initilization.
Read 65 predefined control points from the file. Thus will not invoke the automatic control point detection.
target coord[0]=[87,    138,    43] around subject [87,    138,    43]:     target [43][138][87] -> subject[49][122][87]
target coord[1]=[2,    148,    31] around subject [2,    148,    31]:     ...... not added due to inconsistency of various matching scores.
target coord[2]=[6,    80,    33] around subject [6,    80,    33]:     ...... not added due to inconsistency of various matching scores.
target coord[3]=[68,    58,    56] around subject [68,    58,    56]:     target [56][58][68] -> subject[66][58][72]
target coord[4]=[121,    203,    67] around subject [121,    203,    67]:     target [67][203][121] -> subject[71][198][111]
target coord[5]=[226,    145,    67] around subject [226,    145,    67]:     ...... not added due to inconsistency of various matching scores.
target coord[6]=[87,    184,    20] around subject [87,    184,    20]:     ...... not added due to inconsistency of various matching scores.
target coord[7]=[151,    96,    72] around subject [151,    96,    72]:     target [72][96][151] -> subject[77][103][159]
target coord[8]=[23,    108,    25] around subject [23,    108,    25]:     ...... not added due to inconsistency of various matching scores.
target coord[9]=[49,    198,    40] around subject [49,    198,    40]:     target [40][198][49] -> subject[40][179][43]
target coord[10]=[121,    145,    26] around subject [121,    145,    26]:     ...... not added due to inconsistency of various matching scores.
target coord[11]=[31,    112,    40] around subject [31,    112,    40]:     ...... not added due to inconsistency of various matching scores.
target coord[12]=[29,    70,    63] around subject [29,    70,    63]:     target [63][70][29] -> subject[69][60][27]
target coord[13]=[86,    230,    58] around subject [86,    230,    58]:     target [58][230][86] -> subject[57][219][85]
target coord[14]=[6,    142,    77] around subject [6,    142,    77]:     target [77][142][6] -> subject[81][136][1]
target coord[15]=[166,    197,    34] around subject [166,    197,    34]:     target [34][197][166] -> subject[35][188][162]
target coord[16]=[78,    85,    34] around subject [78,    85,    34]:     target [34][85][78] -> subject[43][84][84]
target coord[17]=[198,    81,    69] around subject [198,    81,    69]:     target [69][81][198] -> subject[73][79][201]
target coord[18]=[13,    240,    55] around subject [13,    240,    55]:     ...... not added due to inconsistency of various matching scores.
target coord[19]=[89,    170,    44] around subject [89,    170,    44]:     target [44][170][89] -> subject[48][152][88]
target coord[20]=[69,    123,    46] around subject [69,    123,    46]:     target [46][123][69] -> subject[52][108][71]
target coord[21]=[76,    125,    36] around subject [76,    125,    36]:     ...... not added due to inconsistency of various matching scores.
target coord[22]=[31,    116,    39] around subject [31,    116,    39]:     ...... not added due to inconsistency of various matching scores.
target coord[23]=[170,    200,    36] around subject [170,    200,    36]:     ...... not added due to inconsistency of various matching scores.
target coord[24]=[77,    84,    36] around subject [77,    84,    36]:     ...... not added due to inconsistency of various matching scores.
target coord[25]=[74,    82,    74] around subject [74,    82,    74]:     target [74][82][74] -> subject[84][81][77]
target coord[26]=[147,    208,    74] around subject [147,    208,    74]:     target [74][208][147] -> subject[77][204][138]
target coord[27]=[60,    113,    74] around subject [60,    113,    74]:     target [74][113][60] -> subject[83][114][60]
target coord[28]=[66,    63,    53] around subject [66,    63,    53]:     target [53][63][66] -> subject[63][62][71]
target coord[29]=[197,    195,    59] around subject [197,    195,    59]:     target [59][195][197] -> subject[61][188][190]
target coord[30]=[137,    206,    59] around subject [137,    206,    59]:     target [59][206][137] -> subject[64][199][128]
target coord[31]=[172,    202,    59] around subject [172,    202,    59]:     target [59][202][172] -> subject[63][197][168]
target coord[32]=[104,    191,    77] around subject [104,    191,    77]:     ...... not added due to inconsistency of various matching scores.
target coord[33]=[83,    152,    81] around subject [83,    152,    81]:     ...... not added due to inconsistency of various matching scores.
target coord[34]=[76,    169,    81] around subject [76,    169,    81]:     target [81][169][76] -> subject[85][164][67]
target coord[35]=[46,    179,    76] around subject [46,    179,    76]:     ...... not added due to inconsistency of various matching scores.
target coord[36]=[89,    145,    49] around subject [89,    145,    49]:     target [49][145][89] -> subject[55][125][87]
target coord[37]=[73,    146,    49] around subject [73,    146,    49]:     ...... not added due to inconsistency of various matching scores.
target coord[38]=[30,    73,    55] around subject [30,    73,    55]:     ...... not added due to inconsistency of various matching scores.
target coord[39]=[12,    147,    38] around subject [12,    147,    38]:     target [38][147][12] -> subject[36][141][8]
target coord[40]=[48,    197,    39] around subject [48,    197,    39]:     target [39][197][48] -> subject[38][178][41]
target coord[41]=[48,    221,    39] around subject [48,    221,    39]:     target [39][221][48] -> subject[42][208][47]
target coord[42]=[12,    214,    39] around subject [12,    214,    39]:     ...... not added due to inconsistency of various matching scores.
target coord[43]=[34,    235,    39] around subject [34,    235,    39]:     ...... not added due to inconsistency of various matching scores.
target coord[44]=[47,    116,    54] around subject [47,    116,    54]:     target [54][116][47] -> subject[58][105][40]
target coord[45]=[42,    221,    54] around subject [42,    221,    54]:     target [54][221][42] -> subject[54][212][39]
target coord[46]=[11,    148,    54] around subject [11,    148,    54]:     target [54][148][11] -> subject[54][142][7]
target coord[47]=[77,    176,    54] around subject [77,    176,    54]:     ...... not added due to inconsistency of various matching scores.
target coord[48]=[27,    205,    54] around subject [27,    205,    54]:     target [54][205][27] -> subject[53][197][22]
target coord[49]=[84,    238,    54] around subject [84,    238,    54]:     ...... not added due to inconsistency of various matching scores.
target coord[50]=[92,    112,    45] around subject [92,    112,    45]:     target [45][112][92] -> subject[53][111][99]
target coord[51]=[137,    184,    45] around subject [137,    184,    45]:     target [45][184][137] -> subject[50][176][128]
target coord[52]=[121,    189,    45] around subject [121,    189,    45]:     ...... not added due to inconsistency of various matching scores.
target coord[53]=[178,    135,    71] around subject [178,    135,    71]:     ...... not added due to inconsistency of various matching scores.
target coord[54]=[178,    183,    69] around subject [178,    183,    69]:     ...... not added due to inconsistency of various matching scores.
target coord[55]=[81,    156,    26] around subject [81,    156,    26]:     ...... not added due to inconsistency of various matching scores.
target coord[56]=[30,    191,    26] around subject [30,    191,    26]:     ...... not added due to inconsistency of various matching scores.
target coord[57]=[33,    234,    26] around subject [33,    234,    26]:     target [26][234][33] -> subject[17][238][13]
target coord[58]=[13,    179,    26] around subject [13,    179,    26]:     target [26][179][13] -> subject[17][161][2]
target coord[59]=[29,    146,    22] around subject [29,    146,    22]:     ...... not added due to inconsistency of various matching scores.
target coord[60]=[18,    226,    18] around subject [18,    226,    18]:     ...... not added due to inconsistency of various matching scores.
target coord[61]=[9,    185,    12] around subject [9,    185,    12]:     target [12][185][9] -> subject[4][169][3]
target coord[62]=[13,    231,    12] around subject [13,    231,    12]:     target [12][231][13] -> subject[4][228][0]
target coord[63]=[23,    107,    29] around subject [23,    107,    29]:     ...... not added due to inconsistency of various matching scores.
target coord[64]=[71,    124,    29] around subject [71,    124,    29]:     target [29][124][71] -> subject[19][138][76]
(1). normalize the point cloud
(2). estimate the initial affine matrix from initial matching using RANSAC

       0,
    (   0). err_invp_min=5.313598
   
    (   3). err_invp_min=5.036110
       5,
    (   9). err_invp_min=4.519104
      10,  15,  20,  25,
    (  29). err_invp_min=4.481841
      30,  35,  40,
    (  43). err_invp_min=4.087120
      45,
      50,  55,
    (  56). err_invp_min=3.705978
      60,  65,  70,  75,  80,  85,
    (  88). err_invp_min=3.688620
      90,  95,
     100, 105, 110, 115, 120, 125, 130, 135, 140, 145,
     150, 155, 160, 165, 170, 175, 180, 185, 190, 195,
     200, 205, 210, 215, 220, 225, 230, 235, 240, 245,
     250, 255, 260, 265, 270, 275, 280, 285, 290, 295,
     300, 305, 310, 315, 320, 325, 330, 335, 340, 345,
     350, 355, 360, 365, 370, 375, 380,
    ( 381). err_invp_min=3.660280
     385, 390, 395,
     400, 405, 410, 415, 420, 425, 430, 435, 440, 445,
     450, 455, 460, 465, 470, 475, 480, 485, 490, 495,
     500, 505, 510, 515, 520, 525, 530, 535, 540, 545,
     550, 555, 560, 565, 570, 575, 580, 585, 590, 595,
     600, 605, 610, 615, 620, 625, 630, 635, 640, 645,
     650, 655, 660, 665, 670, 675, 680, 685, 690, 695,
     700, 705, 710, 715, 720, 725, 730, 735, 740, 745,
     750, 755, 760, 765, 770, 775, 780, 785, 790, 795,
     800, 805, 810, 815, 820, 825, 830, 835, 840, 845,
     850, 855, 860, 865, 870, 875, 880, 885, 890, 895,
     900, 905, 910, 915, 920, 925, 930, 935, 940, 945,
     950, 955, 960, 965, 970, 975, 980, 985, 990, 995,
(3). kill the wrong matches by comparing the distance between A and the corresponding B_invp
(4). de-normalization and get arr_2_invp!
    kill 4 pairs, 32 pairs left!
angle12=12.064 [tedge len=23.622 e1=24.434, e2=46.957]  - drop this plane
angle13=8.083 [tedge len=6.164 e1=41.400, e2=38.962]  - drop this plane
angle13=6.596 [tedge len=6.164 e1=36.235, e2=31.448]  - drop this plane
angle13=11.578 [tedge len=6.164 e1=30.594, e2=29.428]  - drop this plane
angle13=1.975 [tedge len=1.732 e1=48.990, e2=49.346]  - drop this plane
angle12=3.519 [tedge len=1.732 e1=24.000, e2=23.043]  - drop this plane
angle12=2.685 [tedge len=1.732 e1=28.931, e2=27.821]  - drop this plane
angle12=3.675 [tedge len=1.732 e1=27.019, e2=27.000]  - drop this plane
angle12=0.907 [tedge len=1.732 e1=41.449, e2=43.046]  - drop this plane
angle12=160.162 [tedge len=39.774 e1=16.062, e2=24.290]  - drop this plane
angle13=18.892 [tedge len=16.062 e1=49.417, e2=48.166]  - drop this plane
angle23=14.836 [tedge len=15.748 e1=46.141, e2=34.191]  - drop this plane
angle23=17.702 [tedge len=15.748 e1=48.929, e2=41.449]  - drop this plane
angle23=16.322 [tedge len=15.748 e1=49.880, e2=40.694]  - drop this plane
=============================
cc[1]=13.548     target=[87,138,43] subject=[87,122,49]
cc[2]=6.050     target=[68,58,56] subject=[72,58,66]
cc[3]=24.096     target=[121,203,67] subject=[111,198,71]
cc[4]=46.566     target=[151,96,72] subject=[159,103,77]
cc[5]=31.145     target=[49,198,40] subject=[43,179,40]
cc[6]=43.801     target=[29,70,63] subject=[27,60,69]
cc[7]=9.623     target=[86,230,58] subject=[85,219,57]
cc[8]=29.279     target=[6,142,77] subject=[1,136,81]
cc[9]=39.209     target=[166,197,34] subject=[162,188,35]
cc[10]=0.000     target=[78,85,34] subject=[84,84,43]
cc[11]=76.491     target=[198,81,69] subject=[201,79,73]
cc[12]=13.102     target=[89,170,44] subject=[88,152,48]
cc[13]=15.982     target=[69,123,46] subject=[71,108,52]
cc[14]=40.400     target=[74,82,74] subject=[77,81,84]
cc[15]=31.833     target=[147,208,74] subject=[138,204,77]
cc[16]=0.000     target=[60,113,74] subject=[60,114,83]
cc[17]=7.052     target=[66,63,53] subject=[71,62,63]
cc[18]=48.946     target=[197,195,59] subject=[190,188,61]
cc[19]=25.529     target=[137,206,59] subject=[128,199,64]
cc[20]=42.054     target=[172,202,59] subject=[168,197,63]
cc[21]=0.000     target=[76,169,81] subject=[67,164,85]
cc[22]=50.794     target=[12,147,38] subject=[8,141,36]
cc[23]=30.009     target=[48,197,39] subject=[41,178,38]
cc[24]=51.661     target=[48,221,39] subject=[47,208,42]
cc[25]=20.506     target=[47,116,54] subject=[40,105,58]
cc[26]=50.273     target=[42,221,54] subject=[39,212,54]
cc[27]=21.883     target=[11,148,54] subject=[7,142,54]
cc[28]=44.135     target=[27,205,54] subject=[22,197,53]
cc[29]=8.767     target=[92,112,45] subject=[99,111,53]
cc[30]=31.467     target=[137,184,45] subject=[128,176,50]
cc[31]=71.150     target=[13,179,26] subject=[2,161,17]
cc[32]=90.935     target=[9,185,12] subject=[3,169,4]
Overall mean=31.759      std=22.562
-------------------- Finished detecting the best matching points. Now compute displacement field. -------

Prepare save the matching quality record file [t21_256.tif_matching_quality.csv]
method_inconsistency= 0.5077,    model_violation=31.7590
Now save to matching point file of subject to [t21_256.tif_subject.csv]
Now save to matching point file of target to [t21_256.tif_target.csv]

---------------------------------
n=0     x=[87.000 -> 87.000] y=[138.000 -> 122.000] z=[43.000 -> 49.000]
n=1     x=[68.000 -> 72.000] y=[58.000 -> 58.000] z=[56.000 -> 66.000]
n=2     x=[121.000 -> 111.000] y=[203.000 -> 198.000] z=[67.000 -> 71.000]
n=3     x=[151.000 -> 159.000] y=[96.000 -> 103.000] z=[72.000 -> 77.000]
n=4     x=[49.000 -> 43.000] y=[198.000 -> 179.000] z=[40.000 -> 40.000]
n=5     x=[29.000 -> 27.000] y=[70.000 -> 60.000] z=[63.000 -> 69.000]
n=6     x=[86.000 -> 85.000] y=[230.000 -> 219.000] z=[58.000 -> 57.000]
n=7     x=[6.000 -> 1.000] y=[142.000 -> 136.000] z=[77.000 -> 81.000]
n=8     x=[166.000 -> 162.000] y=[197.000 -> 188.000] z=[34.000 -> 35.000]
n=9     x=[78.000 -> 84.000] y=[85.000 -> 84.000] z=[34.000 -> 43.000]
n=10     x=[198.000 -> 201.000] y=[81.000 -> 79.000] z=[69.000 -> 73.000]
n=11     x=[89.000 -> 88.000] y=[170.000 -> 152.000] z=[44.000 -> 48.000]
n=12     x=[69.000 -> 71.000] y=[123.000 -> 108.000] z=[46.000 -> 52.000]
n=13     x=[74.000 -> 77.000] y=[82.000 -> 81.000] z=[74.000 -> 84.000]
n=14     x=[147.000 -> 138.000] y=[208.000 -> 204.000] z=[74.000 -> 77.000]
n=15     x=[60.000 -> 60.000] y=[113.000 -> 114.000] z=[74.000 -> 83.000]
n=16     x=[66.000 -> 71.000] y=[63.000 -> 62.000] z=[53.000 -> 63.000]
n=17     x=[197.000 -> 190.000] y=[195.000 -> 188.000] z=[59.000 -> 61.000]
n=18     x=[137.000 -> 128.000] y=[206.000 -> 199.000] z=[59.000 -> 64.000]
n=19     x=[172.000 -> 168.000] y=[202.000 -> 197.000] z=[59.000 -> 63.000]
n=20     x=[76.000 -> 67.000] y=[169.000 -> 164.000] z=[81.000 -> 85.000]
n=21     x=[12.000 -> 8.000] y=[147.000 -> 141.000] z=[38.000 -> 36.000]
n=22     x=[48.000 -> 41.000] y=[197.000 -> 178.000] z=[39.000 -> 38.000]
n=23     x=[48.000 -> 47.000] y=[221.000 -> 208.000] z=[39.000 -> 42.000]
n=24     x=[47.000 -> 40.000] y=[116.000 -> 105.000] z=[54.000 -> 58.000]
n=25     x=[42.000 -> 39.000] y=[221.000 -> 212.000] z=[54.000 -> 54.000]
n=26     x=[11.000 -> 7.000] y=[148.000 -> 142.000] z=[54.000 -> 54.000]
n=27     x=[27.000 -> 22.000] y=[205.000 -> 197.000] z=[54.000 -> 53.000]
n=28     x=[92.000 -> 99.000] y=[112.000 -> 111.000] z=[45.000 -> 53.000]
n=29     x=[137.000 -> 128.000] y=[184.000 -> 176.000] z=[45.000 -> 50.000]
n=30     x=[13.000 -> 2.000] y=[179.000 -> 161.000] z=[26.000 -> 17.000]
n=31     x=[9.000 -> 3.000] y=[185.000 -> 169.000] z=[12.000 -> 4.000]

#################################
-------------------- Now compute the distances of pixels to the mapping points. -------

z=0 z=1 z=2 z=3 z=4 z=5 z=6 z=7 z=8 z=9 z=10 z=11 z=12 z=13 z=14 z=15 z=16 z=17 z=18 z=19 z=20 z=21 z=22 z=23 z=24 z=25 z=26 z=27 z=28 z=29 z=30 z=31 z=32
-------------------- Now interpolate the DF using linear method. -------

in ApplyDFToChannel(), the subject image data normalizer=255.000
Finish warping the 0th channel.
Done: warping.
Succeed to warp using the DF to the specified channel(s).
The current input file has the surfix [v3draw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
Succeed to save to file test1_999_DF_sx.v3draw
The current input file has the surfix [v3draw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
Succeed to save to file test1_999_DF_sy.v3draw
The current input file has the surfix [v3draw]
The data is not with a TIF surfix, -- now this program assumes it is RAW format defined by Hanchuan Peng.
size of [V3DLONG]=[8], [V3DLONG]=[8] [int]=[4], [short int]=[2], [double]=[8], [float]=[4]
Succeed to save to file test1_999_DF_sz.v3draw
Now save the output/warped image [pointer=0x811d250] datatype_warped=1 sz_warped=[256, 256, 108, 1]
The current input file has the surfix [tif]
The warped image has been saved to the file [t21_256.tif].



Originally posted by Hanchuan Peng:
the displacement fields for separate direction cannpt be all the same (unless the input data do not have any deformation).

You can tryto add a "-F test1" string in my example program on the web page. You should have three output files. If you load them in V3D, you will see them all different.

-hanchuan



Originally posted by Thomas Templier:
I've opened several DF in V3D and they are all the same. Rather dark at the beginning of the stack and bright at the end, and a jump in the last slices. It seems that there might be a small offset somewhere in the header maybe. What do you think of it ?

You said that it is saved in 32 bit float, it means packed in packets of 32 bytes right ?

Best Regards

Thomas
Attachment: DF_xyz.jpg
Aug 10, 2011  07:08 PM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
Ok, yours look like it should look.

On my V3D down in the white window it is written "Voxel Type : UINT8", and on yours you have "Voxel Type: FLOAT32". Should V3D recognize the voxel type automatically ? I have not seen any option to fix this.
I opened each file separately doing
File>Import>Import general image series > 1 file in the same folder, starting image 1, increment 1, file name contains "", pack images in Z dimension


I'm running BA on Fedora 14.
For V3D I have the same on windows 7 too.

My displacement files have a size of 32.0 MB (33,554,475 bytes) and place on disk : 32.0 MB (33,558,528 bytes). (from windows 7)

I try to read them byte per byte in python and all I can get is the "raw_image_stack_by_hpeng" and "L". Then I tried a lot of combinations trying to guess the byte packets sizes but it was unsuccessfull.

So it seems weird but we should be close also I hope.

Thank you for your help

Thomas
Aug 10, 2011  07:08 PM | Hanchuan Peng
RE: Overwrite libtiff in Matlab to run IO toolbox
V3D of course can tell what the datatype is (UINT8, UINT16 or FLOAT32).

what version of V3D you are running?

-hanchuan


Originally posted by Thomas Templier:
Ok, yours look like it should look.

On my V3D down in the white window it is written "Voxel Type : UINT8", and on yours you have "Voxel Type: FLOAT32". Should V3D recognize the voxel type automatically ? I have not seen any option to fix this.
I opened each file separately doing
File>Import>Import general image series > 1 file in the same folder, starting image 1, increment 1, file name contains "", pack images in Z dimension


I'm running BA on Fedora 14.
For V3D I have the same on windows 7 too.

My displacement files have a size of 32.0 MB (33,554,475 bytes) and place on disk : 32.0 MB (33,558,528 bytes). (from windows 7)

I try to read them byte per byte in python and all I can get is the "raw_image_stack_by_hpeng" and "L". Then I tried a lot of combinations trying to guess the byte packets sizes but it was unsuccessfull.

So it seems weird but we should be close also I hope.

Thank you for your help

Thomas
Aug 10, 2011  07:08 PM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
On W7 : v3d_v2.603_win_msvc_64bit
On Fedora : v3d_redhat_fedora_64bit_v2.603

Best
Thomas
Aug 10, 2011  07:08 PM | Hanchuan Peng
RE: Overwrite libtiff in Matlab to run IO toolbox
i will put at the website a new version hopefully soon, so you can try the new one.

-hanchuan


Originally posted by Thomas Templier:
On W7 : v3d_v2.603_win_msvc_64bit
On Fedora : v3d_redhat_fedora_64bit_v2.603

Best
Thomas
Aug 10, 2011  07:08 PM | Thomas Templier
RE: Overwrite libtiff in Matlab to run IO toolbox
Ok.

If I may bother you again, could you give some precisions for the V3D format ?

The problem should come from V3D here normally, not from BrainAligner, so I could still use these displacement fields. I won't use Matlab for it (I did not manage to make it run with the libtiff library as I'm not too experienced).

So the header should have 43 bytes ?  24 + 1 + 2 + 4 + 4 + 4 + 4
Then each number should have how many bytes ? Assuming they have n bytes, something like this should work : 

fread(43)
for ...
   fread(n)

Am I doing a stupid mistake ?

Otherwise, maybe you know the RAW fileopener from Fiji, and it could be used with the right parameters ?

Image Type : 32-bit Signed, Unsigned, Real, ARGB or ABGR
Width :
Height:
Offset to first image : 43 ?
Number of imges :
Gap between images :

White is zero : yes/no
Little-endian byte order : yes/no

Thank you

Thomas




Originally posted by Hanchuan Peng:
i will put at the website a new version hopefully soon, so you can try the new one.

-hanchuan


Originally posted by Thomas Templier:
On W7 : v3d_v2.603_win_msvc_64bit
On Fedora : v3d_redhat_fedora_64bit_v2.603

Best
Thomas
Aug 10, 2011  08:08 PM | Hanchuan Peng
ImageJ plugin to load V3D's Raw format
43bytes is correct.

But I woulduse imagej if the data is not 8bit. (maybe you can figure a way, but I did that before and the experience was not very smooth...)

So Yinan Wan in my lab indeed developed a nice ImageJ/Fiji plugin to load V3D's Raw format. You can check out the code at

svn co https://svn.janelia.org/penglab/projects...

There is a simple README file there explaining how to run.

-hanchuan



Originally posted by Thomas Templier:
Ok.

If I may bother you again, could you give some precisions for the V3D format ?

The problem should come from V3D here normally, not from BrainAligner, so I could still use these displacement fields. I won't use Matlab for it (I did not manage to make it run with the libtiff library as I'm not too experienced).

So the header should have 43 bytes ?  24 + 1 + 2 + 4 + 4 + 4 + 4
Then each number should have how many bytes ? Assuming they have n bytes, something like this should work : 

fread(43)
for ...
   fread(n)

Am I doing a stupid mistake ?

Otherwise, maybe you know the RAW fileopener from Fiji, and it could be used with the right parameters ?

Image Type : 32-bit Signed, Unsigned, Real, ARGB or ABGR
Width :
Height:
Offset to first image : 43 ?
Number of imges :
Gap between images :

White is zero : yes/no
Little-endian byte order : yes/no

Thank you

Thomas




Originally posted by Hanchuan Peng:
i will put at the website a new version hopefully soon, so you can try the new one.

-hanchuan


Originally posted by Thomas Templier:
On W7 : v3d_v2.603_win_msvc_64bit
On Fedora : v3d_redhat_fedora_64bit_v2.603

Best
Thomas
Aug 10, 2011  08:08 PM | Thomas Templier
RE: ImageJ plugin to load V3D's Raw format
Fine !

It seems to work. So the output of BrainAligner is ok for sure and I can deal with my DFs now.

Thank you very much for the help and the high reactivity.
 
Thomas
Aug 10, 2011  08:08 PM | Hanchuan Peng
RE: ImageJ plugin to load V3D's Raw format
I have also just updated the V3D's website and release a Linux (redhat/fedora) version, V2.687.

Can you test it with the DF files and let me know if they load correctly now?

This new version is a really just a pre-release, as we are developing many new features of the system at this moment, and just do not have time to build all binaries for all platforms for a formal release. But I think this is powerful enough and will like to have your test-drive result, :-)

-hanchuan


Originally posted by Thomas Templier:
Fine !

It seems to work. So the output of BrainAligner is ok for sure and I can deal with my DFs now.

Thank you very much for the help and the high reactivity.
 
Thomas
Aug 11, 2011  11:08 AM | Thomas Templier
RE: ImageJ plugin to load V3D's Raw format
It's working. Drag & drop is working also.
Great.

Best Regards.

Thomas
May 24, 2012  02:05 PM | John Roberts
RE: Overwrite libtiff in Matlab to run IO toolbox
Hi,

I have tried to make the MEX file in Windows Seven with Matlab 64-bit. It doesn't work. I am using the recommended compilers from Mathworks (Microsoft Visual C++ 2010 Express, Microsoft Windows SDK 7.1).
I got various errors concerning:
tiffio.h (fixed by adding the files from libtiff)
strings.h (fixed by replacing it with string.h)
int, long not recognized...

I tried alternative compilers (MINGW64 or CYGWIN) but they are so complicated to set up that it's not worth the hassle, while my primary concern is just to save a 3D stack in a raw file!

Could you just include the compiled MEX32 and MEX64 files in the zip files? That would save trouble to so many people.  
Thanks