Skip to content

Commit

Permalink
some minor changes including getting subtract corpus to produce an
Browse files Browse the repository at this point in the history
average image
  • Loading branch information
Tom Close committed Jun 1, 2013
1 parent 43f5d42 commit ad4066a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bash/sort_invivo
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for d in $1/*; do
image_name=`basename $dataset`
structure=${image_name%%.*}
num_encodings=${image_name#*.}
num_encodings=${num_encodings%.*}
num_encodings=${num_encodings%%.*}
parent_dir=$destination/$structure/$subject/$num_encodings
mkdir -p $parent_dir
count=1
Expand Down
11 changes: 7 additions & 4 deletions bash/subtract_corpus
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ for subject_dir in $data_dir/corpus_callosum/*; do
num_width=`fibre_info $run_dir/samples.tst | grep exp_num_width_sections | awk '{print $2}'`
obs_image=`fibre_info $run_dir/samples.tst | grep obs_image | awk '{print $2}'`
obs_image=$REFERENCE_DIR/${obs_image#*params/image/reference/}
img_dims="\"`mrinfo $obs_image | grep Dimensions: | awk '{print $2 " " $4 " " $6}'`\""
img_vox_lengths="\"`mrinfo $obs_image | grep 'Voxel size:' | awk '{print $3 " " $5 " " $7}'`\""
img_offset="\"`mrinfo $obs_image | grep --after-context=2 'Transform:' | xargs echo | awk '{print $5 " " $9 " " $13}'`\""
img_dims="\"`mrinfo $obs_image | grep Dimensions: | awk '{print $2 "," $4 "," $6}'`\""
img_vox_lengths="\"`mrinfo $obs_image | grep 'Voxel size:' | awk '{print $3 "," $5 "," $7}'`\""
img_offset="\"`mrinfo $obs_image | grep --after-context=2 'Transform:' | xargs echo | awk '{print $5 "," $9 "," $13}'`\""
gradient_file=${obs_image%.mif}.grad
mrinfo $obs_image -gradient $gradient_file
echo generate_image $run_dir/last.tct $run_dir/last.mif -img_dims $img_dims -img_vox_lengths $img_vox_lengths -img_offset $img_offset -exp_num_length_sections $num_length -exp_num_width_sections $num_width -diff_encodings_location $gradient_file
#generate_image $run_dir/last.tct $run_dir/last.mif -img_dims $img_dims -img_vox_lengths $img_vox_lengths -img_offset $img_offset -exp_num_length_sections $num_length -exp_num_width_sections $num_width -diff_encodings_location $gradient_file
#echo $img_dims - $img_vox_lengths - $img_offset - $num_length - $num_width
done
num_runs=`ls $data_dir/corpus_callosum/$subject/$dw | wc | awk '{print $1}'`
#echo $subject - $dw - $num_runs
mradd $data_dir/corpus_callosum/$subject/$dw/*/last.mif - | mrmath $num_runs -divide $data_dir/corpus_callosum/$subject/$dw/avg_last.mif
done
done
6 changes: 3 additions & 3 deletions matlab/add_mri_slice_to_plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ function add_mri_slice_to_plot(image_location, x_slice, y_slice, z_slice)
img_limit = offset + img.vox(1:3) .* (img.dim(1:3) - 1);

if any(x_slice > img_limit(1)) || any(x_slice < offset(1))
error(['Slice positions (' num2str(x_slice) ') out of bounds of the image (' num2str(offset(1)) ' -> ' num2str(img_limit(1)) ').'])
error(['X slice position (' num2str(x_slice) ') out of bounds of the image (' num2str(offset(1)) ' -> ' num2str(img_limit(1)) ').'])
end

if any(y_slice > img_limit(2)) || any(y_slice < offset(2))
error(['Slice positions (' num2str(y_slice) ') out of bounds of the image (' num2str(offset(2)) ' -> ' num2str(img_limit(2)) ').'])
error(['Y slice position (' num2str(y_slice) ') out of bounds of the image (' num2str(offset(2)) ' -> ' num2str(img_limit(2)) ').'])
end

if any(z_slice > img_limit(3)) || any(z_slice < offset(3))
error(['Slice positions (' num2str(z_slice) ') out of bounds of the image (' num2str(offset(3)) ' -> ' num2str(img_limit(3)) ').'])
error(['Z slice position (' num2str(z_slice) ') out of bounds of the image (' num2str(offset(3)) ' -> ' num2str(img_limit(3)) ').'])
end

[X,Y,Z]=meshgrid(offset(1):img.vox(1):img_limit(1),...
Expand Down
2 changes: 1 addition & 1 deletion matlab/tracts2strands.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
num_strands = round(sqrt(strands_per_acs * acs));
end

width_fractions = ones(length(tracts),1) ./ num_strands;
width_fractions = ones(size(tracts,1),1) ./ num_strands;

if num_strands < 0
error(['''-num_strands'' must be greater than zero (' num2str(num_strands) ').']);
Expand Down

0 comments on commit ad4066a

Please sign in to comment.