Posted by
Juanjo Vega on
Jul 07, 2009; 1:56pm
URL: http://imagej.273.s1.nabble.com/How-can-I-access-to-the-whole-stack-tp3691874p3691879.html
Hi,
Storing it to a file is not very useful. I need to perform some affine
transforms to the image so, after transforming each point, I get the new
one for each slice. That's because I need to have all the slices loaded
at the same time.
Thanks in anyway for the idea.
Sincerelly,
Juanjo.
Senger Fabrice escribió:
> Juanjo Vega a écrit :
>> Hello,
>>
>> I'm trying to process an entire stack, but I'm having some problems.
>>
>> I wrote the code below in order to understand how to access to each
>> one of the stack slices. The idea is to copy the whole stack into a
>> matrix where each row is a slice and columns store the array of
>> pixels for that slice.
>>
>> The code is very simple, but there's a problem is with
>> "getProcessor()". It doesn't work and I don't know what I'm doing
>> wrong, or if there is another way to get the slice without this method.
>>
>> ImagePlus imgSource;
>>
>> ...
>>
>> short inPixels[][] = new short[imgSource.getStack().getSize()][];
>> for (int stack = 0; stack < inPixels.length; stack++) {
>> IJ.write(" *** Stack : " + stack + " / " +
>> imgSource.getStack().getSize());
>> inPixels[stack] = (short[])
>> imgSource.getStack().getProcessor(stack).convertToShort(true).getPixels();
>>
>> }
>>
>> I also tried to look at:
>>
http://rsb.info.nih.gov/ij/source/ij/plugin/filter/Duplicater.java>>
>> Sincerelly,
>>
>> Juanjo Vega.
>>
> Hi,
>
> this might sound simplistic but, you can save your stack to a folder
> as an image sequence, next you can process each image in that folder.
> Thus you will access the information for each slice in the original
> stack...
>
> Fabrice.
>
--
Juanjo Vega (
[hidden email])
Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.
http://www.cnb.csic.eshttp://www.biocomp.cnb.uam.es+34 91 585 4510
"Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes.