Thanks for looking at my mail and sorry for the late reply. To remind
everyone, the issue I raised is about re-orientation with mri_convert
where width, height and depth are different.
On Dec 16, 2007, at 10:27 PM, Doug Greve wrote:
did you look at the help for mri_convert concerning the orientation?
I did. Let me try to better re-phrase the problem as I see it.
I wrote a ruby script (attached for fun) to generate a 90x30x10, 8-
bit, equal spaced mgh file with all 27,000 voxels set to 255 and the
direction cosines set to LIA orientation.
Next, I did
mri_convert --out_orientation PIL test_lia.mgh test_pil.mgh
and examined the output voxels.
The breakdown is:
24,000 voxels are set to zero.
3,000 voxels are set to 255.
The spacial pattern is sort of random looking although I am sure it is
related to how it is sampling off-volume.
Is this the expected behavior?
By contrast, if you create a 30x30x30 volume of all 255, the PIL
reoriented volume is identical--30x30x30 all 255. Which is completely
what I would expect.
Best regards,
Ray
#!/usr/bin/env ruby
# write a test mgh file
filename = "test_lia.mgh"
file = File.open(filename, "wb")
version = 1 # int 4
width = 90 # int 8
height = 30 # int 12
depth = 10 # int 16
frames = 1 # int 20
type = 0 # int 24
dof = 0 # int 28
goodRASFlag = 1 # short 30
spacingX = 1 # float 34
spacingY = 1 # float 38
spacingZ = 1 # float 42
x_r = -1 # float 46
x_a = 0 # float 50
x_s = 0 # float 54
y_r = 0 # float 58
y_a = 0 # float 62
y_s = -1 # float 66
z_r = 0 # float 70
z_a = 1 # float 74
z_s = 0 # float 78
size = width*height*depth*frames
file.write( [ version,
width, height, depth, frames,
type, dof,
goodRASFlag,
spacingX, spacingY, spacingZ,
x_r, x_a, x_s,
y_r, y_a, y_s,
z_r, z_a, z_s].pack("NNNNNNNngggggggggggg") )
HEADER_SIZE = 284
pad_size = HEADER_SIZE - 78
file.write(Array.new(pad_size).fill(0).pack("C"*pad_size))
file.write(Array.new(size).fill(255).pack("C"*size))
file.close
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer