Hi all,
I'm trying to figure out what's wrong with my macro. Basically it should open all zeiss LSM files in a folder, create a composite colour image (3 channels) keeping the originals save the composite then save the original channels as 8bit gray scale. The composite saves fine but the individual planes it often saves the red channel 3 times and not the other 2. if i split saving of the composite and the originals so they are in 2 scripts it works ok but noT when the code is all together. I'd like to get this running in batch mode so it runs quicker also. Can any one see any fundamental issues here? Thanks for your help, Matt. This is the script: //macro batch converts 3 colour LSM files //into individual channel mono 8 bit tiffs //and a RGB 24bit merge //uses batchmode so images don't need to be opened dir1 = getDirectory("Choose source directory"); //Returns an array containing the names of files in a directory list = getFileList(dir1); dir2 = getDirectory("Choose destination directory"); //Runs the code block and increments for (i=0; i<list.length; i++){ path = dir1+list[i]; run("Bio-Formats Windowless Importer", "open=[path]"); title = File.nameWithoutExtension; run("Stack to Images"); rename("Ch3-T3"); run("Grays"); run("Put Behind [tab]"); rename("Ch2-T2"); run("Grays"); run("Put Behind [tab]"); rename("Ch1-T1"); run("Grays"); run("Merge Channels...", "c1=Ch3-T3 c2=Ch2-T2 c3=Ch1-T1 create keep"); selectWindow("Composite"); run("RGB Color"); selectWindow("Composite (RGB)"); saveAs("Tiff", dir2 + title + "(RGB).tif"); run("Close"); run("Close"); IF I PUT FROM HERE ONWARDS INTO A SEPARATE SCRIPT IT WORKS OK. run("8-bit"); saveAs("Tiff", dir2 + title + "Blue 8 bit"); run("Close"); run("8-bit"); saveAs("Tiff", dir2 + title + "Red 8 bit"); run("Close"); run("8-bit"); saveAs("Tiff", dir2 + title + "Green 8 bit"); run("Close"); } -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. |
Hello,
I have something very similar here: http://dev.mri.cnrs.fr/projects/imagej-macros/wiki/Image_Conversion_Tools It saves an rgb-image not the composite and the single grayscale images. Maybe the macro code can help you. Best regards, Volker Baecker Maybe it On 08/05/12 18:47, Matthew Pearson wrote: > Hi all, > > I'm trying to figure out what's wrong with my macro. > Basically it should open all zeiss LSM files in a folder, create a > composite colour image (3 channels) keeping the originals save the > composite then save the original channels as 8bit gray scale. The > composite saves fine but the individual planes it often saves the red > channel 3 times and not the other 2. > if i split saving of the composite and the originals so they are in 2 > scripts it works ok but noT when the code is all together. I'd like > to get this running in batch mode so it runs quicker also. > Can any one see any fundamental issues here? > Thanks for your help, > Matt. > > > This is the script: > > //macro batch converts 3 colour LSM files > //into individual channel mono 8 bit tiffs > //and a RGB 24bit merge > //uses batchmode so images don't need to be opened > > > dir1 = getDirectory("Choose source directory"); > //Returns an array containing the names of files in a directory > list = getFileList(dir1); > dir2 = getDirectory("Choose destination directory"); > > //Runs the code block and increments > > for (i=0; i<list.length; i++){ > > path = dir1+list[i]; > > run("Bio-Formats Windowless Importer", "open=[path]"); > title = File.nameWithoutExtension; > run("Stack to Images"); > rename("Ch3-T3"); > run("Grays"); > run("Put Behind [tab]"); > rename("Ch2-T2"); > run("Grays"); > run("Put Behind [tab]"); > rename("Ch1-T1"); > run("Grays"); > > run("Merge Channels...", "c1=Ch3-T3 c2=Ch2-T2 c3=Ch1-T1 create keep"); > selectWindow("Composite"); > run("RGB Color"); > selectWindow("Composite (RGB)"); > saveAs("Tiff", dir2 + title + "(RGB).tif"); > run("Close"); > run("Close"); > IF I PUT FROM HERE > ONWARDS INTO A SEPARATE SCRIPT IT WORKS OK. > run("8-bit"); > saveAs("Tiff", dir2 + title + "Blue 8 bit"); > run("Close"); > > run("8-bit"); > saveAs("Tiff", dir2 + title + "Red 8 bit"); > run("Close"); > > run("8-bit"); > saveAs("Tiff", dir2 + title + "Green 8 bit"); > run("Close"); > } > |
Hello,
Does anyone know if it is possible to attain a list of RGB values of each pixel for a certain section of an image using ImageJ without having to find each value by hand? Thanks, Rebecca Lim Sent from my iPad On May 9, 2012, at 12:42 AM, Volker Baecker <[hidden email]> wrote: > Hello, > I have something very similar here: > > http://dev.mri.cnrs.fr/projects/imagej-macros/wiki/Image_Conversion_Tools > > It saves an rgb-image not the composite and the single grayscale images. > Maybe the macro code can help you. > Best regards, > Volker Baecker > > Maybe it > On 08/05/12 18:47, Matthew Pearson wrote: >> Hi all, >> >> I'm trying to figure out what's wrong with my macro. >> Basically it should open all zeiss LSM files in a folder, create a >> composite colour image (3 channels) keeping the originals save the >> composite then save the original channels as 8bit gray scale. The >> composite saves fine but the individual planes it often saves the red >> channel 3 times and not the other 2. >> if i split saving of the composite and the originals so they are in 2 >> scripts it works ok but noT when the code is all together. I'd like >> to get this running in batch mode so it runs quicker also. >> Can any one see any fundamental issues here? >> Thanks for your help, >> Matt. >> >> >> This is the script: >> >> //macro batch converts 3 colour LSM files >> //into individual channel mono 8 bit tiffs >> //and a RGB 24bit merge >> //uses batchmode so images don't need to be opened >> >> >> dir1 = getDirectory("Choose source directory"); >> //Returns an array containing the names of files in a directory >> list = getFileList(dir1); >> dir2 = getDirectory("Choose destination directory"); >> >> //Runs the code block and increments >> >> for (i=0; i<list.length; i++){ >> >> path = dir1+list[i]; >> >> run("Bio-Formats Windowless Importer", "open=[path]"); >> title = File.nameWithoutExtension; >> run("Stack to Images"); >> rename("Ch3-T3"); >> run("Grays"); >> run("Put Behind [tab]"); >> rename("Ch2-T2"); >> run("Grays"); >> run("Put Behind [tab]"); >> rename("Ch1-T1"); >> run("Grays"); >> >> run("Merge Channels...", "c1=Ch3-T3 c2=Ch2-T2 c3=Ch1-T1 create keep"); >> selectWindow("Composite"); >> run("RGB Color"); >> selectWindow("Composite (RGB)"); >> saveAs("Tiff", dir2 + title + "(RGB).tif"); >> run("Close"); >> run("Close"); >> IF I PUT FROM HERE >> ONWARDS INTO A SEPARATE SCRIPT IT WORKS OK. >> run("8-bit"); >> saveAs("Tiff", dir2 + title + "Blue 8 bit"); >> run("Close"); >> >> run("8-bit"); >> saveAs("Tiff", dir2 + title + "Red 8 bit"); >> run("Close"); >> >> run("8-bit"); >> saveAs("Tiff", dir2 + title + "Green 8 bit"); >> run("Close"); >> } >> |
To Rebecca
It should be something more advanced, but the first thing I thought about - is to "split chanells" and save three result pictures as text. Its gonna be a matrix of pixel values in text file. Mabe record a macro... Kirill |
Free forum by Nabble | Edit this page |