View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
3D rotation of 3D image

5.0 | 1 rating Rate this file 17 Downloads (last 30 days) File Size: 1.69 KB File ID: #44990 Version: 1.3

3D rotation of 3D image



09 Jan 2014 (Updated )

3D rotation of 3D image

| Watch this File

File Information

This function rotates a 3D image based on angle and axis to rotate a round to.
interpolation methods include: nearest neighbor and linear interpolation.
The rest of the image that is out of bound is marked with nan.
the output image will be padded with nan or can be cropped depend on the parameters.

Full Syntax example:
rotatedImg = rotImg3( img, teta, ax, method )
img is the 3D image, teta is the angle in radians, ax is the
axis of rotation for exmple [1 0 0], method can be nearest for nearest
neighbor of linear interpolation. pad =(true|false) is wheter or not to pad the object
with nan or to crop the image after the rotation and leave it same size.

example use for rotating a cylinder:
nS = 30; % cylynder size
cylBlock = repmat([1 zeros(1,nS-2) 1], nS,1);
cyl = zeros(nS,nS,nS);
cyl(:,:,1) = ones(nS,nS);
cyl(:,:,end) = ones(nS,nS);
cyl(:,:,2:end-1) = repmat( cylBlock, [1 1 nS-2]);
rotatedCyl = rotImg3(double(cyl), 1*pi/4 , [0 1 0 ]);

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
18 Feb 2014 Abhishek Anchal

13 Jan 2014 1.1

fix bugs add notes

14 Feb 2014 1.2

fix bugs, huge refactor to use matlab interp3 instead of own implemention

18 Feb 2014 1.3

remove dependency in find3 (own private function)

Contact us