Working with Cell Array, Indexing

2 Ansichten (letzte 30 Tage)
Jessica
Jessica am 14 Jul. 2014
Beantwortet: Ben11 am 14 Jul. 2014
I'm working on doing some image analysis and I want to be able to manipulate the pixel data.
I have multiple channels (channel1, channel2, channel3) which correspond to pixel data of the image for different laser colors. I'm working with confocal microscopy. Specifically with a Z-stack image.
So far I can put the data that I want to analyze into a cell array.
For example, channel1 is a 44x1 cell. All channels for a certain image will be the same length. However different images won't necessarily be 44. They could be nx1
channel1 is a 44x1 cell. It contains matrices that are 2048x2048 which contain the pixel information
2048x2048 uint16
2048x2048 uint16
...
2048x2048 uint16
I want to be able to take one of the matrices in the cell array and adjust the pixels within it. Then put it back in the same position in a new cell array.
So my issue is basically how to access the matrix in R1C1 of channel1, perform a manipulation of the pixel data in that matrix, and take that new matrix and put it into a new_cell_array in position R1C1.
Then repeat that procedure for the matrix found in R2C1 of channel 1 and put it in new_cell_array in position R2C1. And so on and so forth
Any help would be greatly appreciated

Antworten (2)

José-Luis
José-Luis am 14 Jul. 2014
I am sorry, but I don't really understand how your data is structured. Are you having troubling addressing data in your cell array?
If so, please read this.

Ben11
Ben11 am 14 Jul. 2014
When you say: However different images won't necessarily be 44. They could be nx1 do you mean that some stacks will contain 44 images and other n images?
If so it might be simpler to store every image (with all 3 channels) in a single cell, forming a cell array containing nx1 cells instead of 3 cell arrays of size nx1. You could then access the data of every image like so (and after looking at the link @José-Luis provided):
YourImage(Height,Width,Channel) = YourCellArray{i};
% Here Height = Width = 2048 and Channel can be either 1,2 or 3. i would be the index corresponding to the image you want to access in your cell array, hence could could implement a for-loop to modify each image in some way or use cellfun for example to apply a similar function on every image.
Is that what you meant?

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by