From: Ryan on
Hi,

I have an MRI slice and have extracted numerous start and end pixels in order to measure the change in matrix value (fibre orientation) across the heart walls, i.e. from pixel a to pixel b.

I have a matrix M which is 256x256x130 but for this part I am only concerned with the 79th slice, so M1 = 256x256 for the 79th slice.

I want to obtain a matrix which represents the distance from pixel a to pixel b and then plot the change in its matrix value from start to finish.

My initial approach was to do as follows:

M2 = M1(y1:y2, x2:x1) which leaves matrices of the form 17 x 16.

There are a lot of useless pixels in this new matrix and plotting it has 17 lines as opposed to 1. I only concerned with 23 pixels in this example, as the euclidean distance between the two pixels is 23.2.

This approach works when the x or y matrix dimensions are 1, i.e. a 23x1 matrix.

Am I missing something?
From: Joshua Arnott on
"Ryan " <ryanbloor(a)hotmail.com> wrote in message <hnk79d$m3q$1(a)fred.mathworks.com>...
> Hi,
>
> I have an MRI slice and have extracted numerous start and end pixels in order to measure the change in matrix value (fibre orientation) across the heart walls, i.e. from pixel a to pixel b.
>
> I have a matrix M which is 256x256x130 but for this part I am only concerned with the 79th slice, so M1 = 256x256 for the 79th slice.
>
> I want to obtain a matrix which represents the distance from pixel a to pixel b and then plot the change in its matrix value from start to finish.
>
> My initial approach was to do as follows:
>
> M2 = M1(y1:y2, x2:x1) which leaves matrices of the form 17 x 16.
>
> There are a lot of useless pixels in this new matrix and plotting it has 17 lines as opposed to 1. I only concerned with 23 pixels in this example, as the euclidean distance between the two pixels is 23.2.
>
> This approach works when the x or y matrix dimensions are 1, i.e. a 23x1 matrix.
>
> Am I missing something?

Assuming your matrix M2 is not (always) square, as in your example, you're going to have to do some interpolation. See:

doc interp2

Josh.
From: Walter Roberson on
Ryan wrote:

> I have an MRI slice and have extracted numerous start and end pixels in
> order to measure the change in matrix value

> I want to obtain a matrix which represents the distance from pixel a to
> pixel b and then plot the change in its matrix value from start to finish.
> My initial approach was to do as follows:
>
> M2 = M1(y1:y2, x2:x1) which leaves matrices of the form 17 x 16.
> There are a lot of useless pixels in this new matrix and plotting it has
> 17 lines as opposed to 1. I only concerned with 23 pixels in this
> example, as the euclidean distance between the two pixels is 23.2.
> This approach works when the x or y matrix dimensions are 1, i.e. a 23x1
> matrix.

Pixels, being quantized rectangles or square, are not 1 unit in every
direction. For example, the distance from one corner of the pixel to the
diagonally opposite corner is sqrt(2). This is going to be important if
you are trying to determine the number of pixels by euclidean distance.

I also recommend that you think about the issues that I raised in
http://groups.google.ca/group/comp.soft-sys.matlab/browse_thread/thread/ea79bc51232c29d3/db06bab601cd912d
as they will show you that the number of pixels you need to pay
attention to is not the same as the euclidean distance.