Hi,

Yes, this is a good way of doing it and what I had in mind for that option.  However, if you find this too difficult (or the shifted slices ends up with too much cropped off, which is quite likely) then averaging the single slices from either side is probably a lot easier.

All the best,
Mark


On 23 Jan 2014, at 22:15, Michael Dwyer <[log in to unmask]> wrote:

Hi, 

Probably there is a more elegant way, but I would use FLIRT with applyxfm to apply a known transform. Assuming you have left.nii.gz, right.nii.gz, and mid.nii.gz, where mid.nii.gz is the single bad slice:

flirt -in mid.nii.gz -ref mid.nii.gz -out mid_moved.nii.gz -applyxfm -init shift_matrix.mat

To make shift_matrix.mat, you can use the identity matrix (put it as text in the shift_matrix.mat file) with just the shift you need.

Identity would be:
1 0  0  0    <----- X shift
0  1 0  0    <----- Y shift
0  0  1 0    <----- Z shift
0  0  0  1

Edit the zeros in the last column to specify Y and/or Z shift.

Will probably require a little trial and error...

Regards,
Mike






On Thu, Jan 23, 2014 at 4:46 AM, charujing123 <[log in to unmask]> wrote:
Hi Mark,
Thanks Mark.
I splited the volume into to 3 parts. But I didnot know how to shift the part which had a bad slices.
Would you please tell me which command I can use to shift the position?
Thanks.
All the best.
Rujing Zha
 
2014-01-23

charujing123

发件人:Mark Jenkinson <[log in to unmask]>
发送时间:2014-01-23 06:49
主题:Re: [FSL] 3d image has a dislocation slice
收件人:"FSL"<[log in to unmask]>
抄送:
 
Hi,

If you look at the single slice and it still contains all the brain, but just shifted (and it looks like this _might_ be true) then you can try and shift the single slice into place.  To do this you need to separate the image into parts (the section to the left of the single slice, the single slice itself, and the section to the right) - you can do this with fslroi (see the first practical in the FSL course if you are not familiar with this).  Then you can shift the slice appropriately, and then put all the parts back together using fslmerge.

Alternatively, you could generate a replacement slice by averaging the slices on either side of the bad slice.
This would involve taking more parts (separating the single slices to the left and right of the bad slice) and then averaging the single slices with fslmaths, then putting it all back together with fslmerge.

I hope this helps.
All the best,
Mark



On 22 Jan 2014, at 07:15, charujing123 <[log in to unmask]> wrote:

Hi all,
I have a 3d image which has a problem: one slice drops away from the others.How can I fix the problem. Image can be got from the attachment.
Thanks.
All the best.
Rujing Zha
 
University of Science and Technology of China
 
2014-01-22

charujing123
<20140122145852.jpg>




--
Michael G. Dwyer, Ph.D.
Assistant Professor of Neurology
Director of Technical Imaging Development
Buffalo Neuroimaging Analysis Center
University at Buffalo
100 High St. Buffalo NY 14203
[log in to unmask]
(716) 859-7065