• 検索結果がありません。

Sections and Orientations of the brain

N/A
N/A
Protected

Academic year: 2018

シェア "Sections and Orientations of the brain"

Copied!
8
0
0

読み込み中.... (全文を見る)

全文

(1)

2014/05/26 Hiroyuki AKAMA

Sections and Orientations of the brain:

An example of anatomical or structural scan with the voxel size of 2-2-2 mm.

Let's load today's dataset, which is a simple 3D array.

>> load('brainimg.mat');

%A data in the variable named 'brainimg' is now loaded in the work space of MATLAB.

>>brainimg

%Let's see the 3D array representing a (standard) brain image...

>> size(brainimg)

Axial, Transverse, Horizontal

Coronal Sagittal

Superior Superior

Inferior

Inferior

Left Right

Posterior Anterior

Left Right

Anterior Posterior

(2)

ans =

53 63 23

%This is a 3D array with the size of 53 by 63 by 23.

>>size(brainimg,1)*size(brainimg,2)*size(brainimg,3) ans =

76797

%The total number of voxels in this volume is 76797.

%A coarse brain scan with the spatial resolution of 3 by 3 by 6 mm. The spatial resolution is very low but the file size is relatively small.

>> imagesc(brainimg(:,:,15))

%One axial (transverse, horizontal) slice Left

Right

Posterior(Caudal)<--->Anterior(Rostral)

>> imagesc(permute(brainimg(:,30,:), [1 3 2]))

%A coronal slice (=x-z plane). Note that the slice number 30 (in the middle, as a 'y' Lateral

Medial

Lateral

(3)

value) can be specified by a permutation order of [1 3 2] and that the integer 2 for 'y' value is at the end of this list. The image is toppled over sideways.

%imagesc(transpose(permute(brainimg(:,30,:), [1 3 2])))

>>imagesc(flipud(transpose(permute(brainimg(:,30,:), [1 3 2]))))

Superior (Dorsal)

Inferior (Ventral)

Left<--->Right

%flipud() flips array up to down.

>>colormap(gray)

%If you want to use the grey scale, here you are.

(4)

>> imagesc(flipud(transpose(permute(brainimg(26,:,:), [2 3 1]))))

% A sagittal slice (=a y-z plane) near the midline (we have 53 sagittal slices in total). Note that the slice number 26 (as the first element, an 'x' value) can be specified by a permutation order of [2 3 1] and that the integer 1 for 'x' value is at the end of this list. Using the flipud function, the image is not upside down.

Superior (Dorsal)

Posterior (Caudal)<--->Anterior (Rostral) Inferior (Ventral)

cf. flipping array...

>> tmp=rand(4,5) tmp =

(5)

0.8147 0.6324 0.9575 0.9572 0.4218 0.9058 0.0975 0.9649 0.4854 0.9157 0.1270 0.2785 0.1576 0.8003 0.7922 0.9134 0.5469 0.9706 0.1419 0.9595

>> flipud(tmp) %flip array top to bottom. ans =

0.9134 0.5469 0.9706 0.1419 0.9595 0.1270 0.2785 0.1576 0.8003 0.7922 0.9058 0.0975 0.9649 0.4854 0.9157 0.8147 0.6324 0.9575 0.9572 0.4218

>> fliplr(tmp) %flip array left to right. ans =

0.4218 0.9572 0.9575 0.6324 0.8147 0.9157 0.4854 0.9649 0.0975 0.9058 0.7922 0.8003 0.1576 0.2785 0.1270 0.9595 0.1419 0.9706 0.5469 0.9134

>>coronal_img=imagesc(flipud(transpose(permute(brainimg(:,35,:), [1 3 2]))));

>>flipped_coronal_img=imagesc(fliplr(flipud(transpose(permute(brainimg(:,35,:), [1 3 2])))));

% You can make a mirror-reversed image using the function of fliplr().

>>saveas(coronal_img,'z:¥¥coronal_img.jpg','jpg')

>>saveas(flipped_coronal_img,'z:¥¥flipped_coronal_img.jpg','jpg') Superior Superior

Inferior Inferior

Left<--->Right Right<--->Left A coronal slice and its flipped coronal slice. Left-Right versus Right-Left.

(6)

There are two kinds of ways to define Left and Right: Neurological Left-Right versus Radiological Left-Right.

Neurological: Left and Right for a subject, so thought from behind him/her. Radiological: Left and Right for an observer looking toward the face of a subject.

How to make your own Matlab function for display a slice of brain from a 3D array.

You might want to an 'm' file (file extension: m), which is a text file and whose name is identical to that of the function you want to implement there.

For example, let's create your function imagesc_coronal(<3D array>,<slice number>) as ' imagesc_coronal.m'.

function img= imagesc_coronal(threeDarray, slicenum)

%function <returned value>=<function name(file name)>(arguments)

%threeDarray and slicenum are temporary arguments.

imagesc(flipud(transpose(permute(threeDarray(:,slicenum,:), [1 3 2]))));

If you locate this m file in a directory to which you added the path so that Matlab can automatically search for it (you have to run beforehand addpath(<directory name>)), you can use the function executing for example,

>>imagesc_coronal(brainimg, 40)

to get the image of a coronal slice as follows.

But if you misuse it, error messages will appear.

(7)

>>imagesc_coronal(brainimg, 70)

??? インデックスが行列の次元を超えています。

エラー ==> imagesc_coronal at 2

imagesc(flipud(transpose(permute(threeDarray(:,slicenum,:), [1 3 2]))));

>> imagesc_coronal(brainimg, 20, 1)

??? エラー ==> imagesc_coronal 入力引数が多すぎます

However, it happens that the function mistakenly works well under some inappropriate parameter settings, for example, in the case of assigning a 2D array to the first argument.

>> imagesc_coronal(randn(30,30), 25)

So it would be better to expect some possible wrong uses and answers to them as error messages you customize by yourself.

function img = imagesc_coronal(threeDarray, slicenum) if(size(size(threeDarray),2)~=3)

error('imagesc_coronal.m:The first argument should be a three dimensional array.');

end

if(slicenum>size(threeDarray,2))

error('imagesc_coronal.m:The slice number you assigned is too large.'); end

imagesc(flipud(transpose(permute(threeDarray(:,slicenum,:), [1 3 2]))));

(8)

>> imagesc_coronal(randn(30,30), 25)

??? エラー ==> imagesc_coronal at 8

imagesc_coronal.m:The first argument should be a three dimensional array.

>> imagesc_coronal(brainimg, 70)

??? エラー ==> imagesc_coronal at 12

imagesc_coronal.m:The slice number you assigned is too large.

Another example:

function img = imagesc_coronal_lr(threeDarray, slicenum) if(size(size(threeDarray),2)~=3)

error('imagesc_coronal_lr.m:The first argument should be a three dimensional array.');

end

if(slicenum>size(threeDarray,2))

error('imagesc_coronal_lr.m:The slice number you assigned is too large.'); end

image_source=flipud(transpose(permute(threeDarray(:,slicenum,:), [1 3 2])));

subplot(1,2,1)

%The first row first column image number 1. imagesc(image_source);

axis image

title(strcat('Coronal slice: ', num2str(slicenum)))

subplot(1,2,2)

%The first row second column image number 2. imagesc(fliplr(image_source));

axis image

title(strcat('Mirror-reveres coronal slice: ', num2str(slicenum)))

%run imagesc_coronal_lr(brainimg, 36)

参照

関連したドキュメント

It is suggested by our method that most of the quadratic algebras for all St¨ ackel equivalence classes of 3D second order quantum superintegrable systems on conformally flat

We show that a discrete fixed point theorem of Eilenberg is equivalent to the restriction of the contraction principle to the class of non-Archimedean bounded metric spaces.. We

Instead an elementary random occurrence will be denoted by the variable (though unpredictable) element x of the (now Cartesian) sample space, and a general random variable will

In this paper, we study the generalized Keldys- Fichera boundary value problem which is a kind of new boundary conditions for a class of higher-order equations with

Kilbas; Conditions of the existence of a classical solution of a Cauchy type problem for the diffusion equation with the Riemann-Liouville partial derivative, Differential Equations,

Applications of msets in Logic Programming languages is found to over- come “computational inefficiency” inherent in otherwise situation, especially in solving a sweep of

Global transformations of the kind (1) may serve for investigation of oscilatory behavior of solutions from certain classes of linear differential equations because each of

Our method of proof can also be used to recover the rational homotopy of L K(2) S 0 as well as the chromatic splitting conjecture at primes p &gt; 3 [16]; we only need to use the