开发者

Interpolating along the 2-D image slices

开发者 https://www.devze.com 2023-03-22 08:03 出处:网络
I have a set of 100 2-D image slices of the same size. I have used MATLAB to stack them to create a volumetric data. While the size o开发者_运维知识库f the 2-D slices is 480x488 pixels, the direction

I have a set of 100 2-D image slices of the same size. I have used MATLAB to stack them to create a volumetric data. While the size o开发者_运维知识库f the 2-D slices is 480x488 pixels, the direction in which the images are stacked is not wide enough to visualize the volume in different orientation when projected. I need to interpolate along the slices to increase the size for visualization.

Can somebody please give me an idea or tip about how to do it?

Edit: Anotated projected microscopy-images

Interpolating along the 2-D image slices

Interpolating along the 2-D image slices

The figure 1 is the top-view of the projected volume.

The figure 2 is the side-view of the projected volume.

When I change the rotation-angle, and try to visualize the volume in different orientation, e.g. side-view (figure 2), is what I see as in figure 2.

I want to expand the side view by interpolating along the image slices.


Here is an adapted example from the MATLAB documentation on how to visualize volumetric data (similar to yours) using isosurfaces:

%# load MRI dataset: 27 slices of 128x128 images
load mri
D = squeeze(D);       %# 27 2D-images

%# view slices as countours
contourslice(D,[],[],1:size(D,3))
colormap(map), view(3), axis tight

%# apply isosurface
figure
%#D = smooth3(D);
p = patch( isosurface(D,5) );
isonormals(D, p);
set(p, 'FaceColor',[1,.75,.65], 'EdgeColor','none')
daspect([1 1 .5]), view(3), axis tight, axis vis3d
camlight, lighting gouraud

%# add isocaps
patch(isocaps(D,5), 'FaceColor','interp', 'EdgeColor','none');
colormap(map)

Interpolating along the 2-D image slices

Interpolating along the 2-D image slices


MATLAB has a function interp3 that can be used for interpolation, assuming that the data is uniformly discretised.

Check out the documentation.

Hope this helps.

EDIT: The MATLAB function interp3 works as follows:

vi = interp3(x, y, z, v, xi, yi, zi);

I assume that your "stack" of slices defines the arrays x, y, z, v as 3D arrays, where x, y are the coordinates of the pixels in the plane, z is the "height" of each slice and v is the actual image slices, maybe as "intensity" values for the pixels.

If you want to interpolate new image slices at intermediate z values you could specify these levels in the zi array. The arrays xi, yi would again represent the coordinates of the pixels in the plane.


I created a function to interpolate along image slices. Below is the code:

    function res = interp_along_slices( vol, scale )
    % Interpolation along the image slices

    % Get the size of the volume
      [r c p] = size(vol);

    % Pre-allocate the array:
    % the third dimension is scale times the p
      vol_interp = zeros(r,c,scale*p);

    % interpolate along the image slices 
      for inr = 1:r;
          for jnr = 1:c;
              xi = vol(inr,jnr,:);
              vol_interp(inr,jnr,:) = interp(xi, scale); 
          end;
      end;

      res = vol_interp;

    end
0

精彩评论

暂无评论...
验证码 换一张
取 消