How to convert/save a 3D watershed segmented RGB image stack to a .txt file by assigning unique integers to each 3D label
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
I have a stack of RGB images which have been labeled by applying 3D watershed algorithm, each grain (region) in the dataset has a unique identifier (color) associated with it. I want to store the information of each 3D labeled grain in a text (.txt) file. As after cancatenation of 2d image sections, each grain(color) takes 3D form and comprises of many voxels. To explain, consider a red color grain comprises of 5 voxels and a green color grain comprises of 4 voxels, then i want to assign a unique integer to every color grain, so i assign for example here the integer '230' to each voxel of red color grain and integer '150' to each voxel of green color grain and...... so on (different integer for different color grain), thus the frmat of the text file would be 230 230 230 230 230 150 150 150 150.......
here 230 230 230 230 230 is for five voxels of red grain and 150 150 150 150 is for four voxels of green grain. similarly, i want to apply this procedure to all the 3D grains in my image stack and save the assigned integers in a .txt file. The dimensions of my sample volume are 400x400x120. some images of my dataset are uploaded here for information http://www.sendspace.com/file/ifu50s . I am fairly new to matlab and searched several times for it solution but unfortunately failed. Can any one guide me please? Any help will be highly appreciated!
Thanks
2 comentarios
Sean de Wolski
el 26 de Sept. de 2012
Editada: Sean de Wolski
el 26 de Sept. de 2012
I would like to help, but I don't particularly want to download a file from an untrusted source. Can you provide a small example of input/operations/expected outputs?
Walter Roberson
el 1 de Oct. de 2012
Note: the most-active volunteers will seldom download .rar files. They are more likely to download .zip files, but they prefer plain images posted to a system that allows them to preview what they would be downloading.
Respuesta aceptada
Image Analyst
el 27 de Sept. de 2012
Editada: Image Analyst
el 27 de Sept. de 2012
See my color segmentation demos http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. Or if you're lucky, you can get by with rgb2ind to do the color segmentation. Then, once you've segmented your image into two binary images of all the red particles, and all the green particles, you can multiply the binary images by some number (the intensity that you want them to be like 230 or 150) and recombine with cat(3, r, g, b) to construct your RGB image.
If that's not what you want, then upload two simple 2D images of input and output, to illustrate what you want.
I didn't quite understand what you want since the subject doesn't exactly agree with the body of your message. Looking at your subject line, I'd recommend the function label2rgb() to convert an already-labeled image into an image where the labeled objects have a color, though you'd need to know which object number was which class (red or green).
15 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!