|
"Arvind " <ab835@georgetown.edu> wrote in message
news:hafpcf$ls9$1@fred.mathworks.com...
> Hi guys,
>
> I have a 4D matrix with image information (rows/columns of image data,
> number of slices per stack of images, and number of timepoints- that is,
> number of stacks of images). I want to extract just the
> rows/columns/number of slices per stack into new variables so I am able to
> use the implay command (implay cannot read 4d matrices). However, every
> unique set of 4d data may contain different timepoints, so in some cases I
> may need to make 4 new variables to store the 3d matrix, or maybe 14.
M = rand(100, 100, 3, 10); % 100-by-100 image, 3 slices per stack, 10 time
points
for k = 1:10
subplot(5, 2, k);
imshow(M(:, :, :, k)) % Treat this as an RGB image, showing each time
step in its own subplot
end
Of course, with random data, that's not likely to be very interesting, but
it should be more interesting when you adapt it to your needs.
> I've tried something along the lines of:
> movie_tp=sprintf('mov%d',t) <--where 't' is the timepoint
> counter in the outermost for loop
> mov_tempstore(r,c,s)=x(r,c,s,t); <---just storing
> specific information to the particular timepoint
> assignin('base',movie_tp,mov_tempstore) <---assigning
> the data to the new variable 'mov1'
DO NOT DO THIS. See the newsgroup FAQ for an explanation why you shouldn't.
> mov1 <---When I try to access 'mov1,' I get an error
> saying such a variable doesn't exist.
>
> I think some really easy solution is flying over my radar, but I'd
> appreciate any help with this!
--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|