09.08.2013 Views

Analyse avec le logiciel imagej d'un lot d'images en microscopie par ...

Analyse avec le logiciel imagej d'un lot d'images en microscopie par ...

Analyse avec le logiciel imagej d'un lot d'images en microscopie par ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C:\Docum<strong>en</strong>ts and Settings\montarou\Bureau\correction\chandez\PLU_RGB_Avg_v3_.java jeudi 22 juil<strong>le</strong>t 2010 16:22<br />

blueStack.addSlice("blueConvertToByte", correctedBlueChannel.getProcessor());<br />

// do stack conversions<br />

RGBStackMerge stackMerge = new RGBStackMerge();<br />

int d = redStack.getSize();<br />

boo<strong>le</strong>an keep = true;<br />

ImageStack stackRGB = stackMerge.mergeStacks(width, height, d, redStack, gre<strong>en</strong>Stack,<br />

blueStack, keep);<br />

ImagePlus correctRGBVersion = new ImagePlus("RGB result of "+sci<strong>en</strong>ceImg.getShortTit<strong>le</strong><br />

(), stackRGB);<br />

new Fi<strong>le</strong>Saver(correctRGBVersion).saveAsTiff(outputDir+"RGB result of "+sci<strong>en</strong>ceImg.<br />

getShortTit<strong>le</strong>()+" (sca<strong>le</strong>="+(doScaling?"true":"false")+").tif");<br />

correctRGBVersion.show();<br />

in2p3-00530281, version 1 - 28 Oct 2010<br />

}<br />

/*<br />

IJ.run("Histogram");<br />

Do multiplication/division/addition/sousytaction of two images<br />

Call on each RVB channel<br />

Creates a "Corrected_" image<br />

*/<br />

public static ImagePlus doCorrection(ImagePlus imp1, ImagePlus imp2) {<br />

ImageProcessor ip1 = imp1.getProcessor(); // target processor ip1<br />

ImageProcessor ip2 = imp2.getProcessor(); // source processor ip2<br />

// 8-bit image contains pixels which values range from 0 to 255<br />

// If you have a pixel with a value of 200 and you multiply it by 3 it will become 255 not 600.<br />

// So, 32 bits conversion!<br />

// Take original image transform it into 32-bit (Image > Type > 32-bit)<br />

// Mathematic operation should not have under/overflow prob<strong>le</strong>ms<br />

ip1 = ip1.convertToFloat();<br />

ip2 = ip2.convertToFloat();<br />

ip1 = ip1.duplicate(); // Returns a duplicate of this image.<br />

try {<br />

if (ip1 instanceof ColorProcessor)<br />

IJ.showMessage("calculate", "Error : ip must be converted to float");<br />

switch (operator) {<br />

case 0: operator = Blitter.ADD; break;<br />

case 1: operator = Blitter.SUBTRACT; break;<br />

case 2: operator = Blitter.MULTIPLY; break;<br />

case 3: operator = Blitter.DIVIDE; break;<br />

}<br />

// Performs correction using specified method<br />

ip1.copyBits(ip2, 0, 0, operator);<br />

}<br />

catch (Il<strong>le</strong>galArgum<strong>en</strong>tException e) {<br />

IJ.error("My error " + imp1.getTit<strong>le</strong>() + ": " + e.getMessage());<br />

return null;<br />

}<br />

ImagePlus result = new ImagePlus("Corrected_32-bit_"+imp1.getTit<strong>le</strong>(), ip1);<br />

-14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!