imagej MER basics

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 Next
Author Message
hortonheardawho







PostPosted: April 12, 2012 2:49 PM 

Ok, with two people now officially requesting help using imagej to process MER images, so it is time for this topic.

I will assume that you have downloaded and installed imagej and that you have downloaded some raw MER image data from somewhere. For example, you can get images from the official MER site or from the Exploratorium site.

To test your imagej install you can use the three images below:

sol 2917 L4:

1P387141175ESFBR51P2111L4M1

sol 2917 L5:

1P387141206ESFBR51P2111L5M1

sol 2917 L6:

1P387141237ESFBR51P2111L6M1

OK, now that you have downloaded the test filter images to a convenient directory ( folder ), start the program imagej.

Click on the menu item File / Open... and navigate to the directory where you saved the test images.

Select the L4 image. It should appear in a separate window. Repeat the File/Open... for the L5 and the L6 images.

You should now have the L4, L5 and L6 images open.

Now click on the menu item Image / Color / Merge Channels...

The color Merge window should have the L4 image file name in the Red: input box and the L5 and L6 files in the Green: and Blue: boxes. The Grey: box should be *None*.

Make sure the Create Composit: check box is checked OFF. ( ie, no checkmark in the box )

If you don't want the source images automatically closed after the color image is created click "on" the Keep Source Images box.

Finally, click the OK button and you should now see a window with this image:

1P387141175ESFBR51P2111L456

Congratulations! You have just created your first MER false color image!

Now, select the menu item File / Save.

Give the color image a suitable name ( I use the name of the L4 file with "56" added after the "L4". ) and save it somewhere.

In the future I will post the command sequences as imagej macros and you can copy and paste the commands from the comments to a macro and run the macro to process the images.

For example, here is the commands for my macro L234567x2mx-3 that produces three images from all the left pancam filters:

------------------------------------------

run("16-bit");
run("Put Behind [tab]");
run("16-bit");
run("Put Behind [tab]");
run("16-bit");
run("Put Behind [tab]");
run("16-bit");
run("Put Behind [tab]");
run("16-bit");
run("Put Behind [tab]");
run("16-bit");
NT=getTitle();
NT=substring(NT,0,lengthOf(NT)- Cool ;
run("Images to Stack");
run("Multiply...", "stack value=255.000");
run("Scale...", "x=2 y=2 width=640 height=544 interpolate process create title=Stack-1");
run("Z Project...", "start=1 stop=3 projection=[Min Intensity]");
selectWindow("Stack-1");
run("Z Project...", "start=4 stop=4 projection=[Min Intensity]");
selectWindow("Stack-1");
run("Z Project...", "start=5 stop=6 projection=[Max Intensity]");
run("Images to Stack");
rename("RGB");
selectWindow("Stack");
close();
selectWindow("Stack-1");
close();
run("Stack to RGB");
rename("L234567x2");
selectWindow("RGB");
run("Square Root", "stack");
run("Multiply...", "stack value=255.000");
run("Stack to RGB");
rename("L234567x2sqt");
selectWindow("RGB");
close();
run("Duplicate...", "title=L234567x2sqt-1");
run("Multiply...", "value=0.667");
selectWindow("L234567x2");
run("Duplicate...", "title=L234567x2-1");
run("Multiply...", "value=0.333");
imageCalculator("Add create", "L234567x2sqt-1","L234567x2-1");
//run("Image Calculator...", "image1=L234567x2sqt-1 operation=Add image2=L234567x2-1 create");
rename(NT+"L234567x2hdr");
selectWindow("L234567x2sqt-1");
close();
selectWindow("L234567x2-1");
close();
selectWindow("L234567x2sqt");
rename(NT+"L234567x2sqt");
selectWindow("L234567x2");
rename(NT+"L234567x2");

-------------------------------------

hortonheardawho


Posts: 3465

Reply: 1



PostPosted: April 12, 2012 2:56 PM 

Your homework assignment: Download L2, L5 and L7 filter images and produce a "false color" L257 image.

For extra credit, download R1 and and R2 images and create a "synthetic false color" image using R2 as the Red channel, R1 as the Blue channel and the average of R1 and R2 as the green channel. Hint: Use the menu item Process / Image Calculator to compute the average.

hortonheardawho


Posts: 3465

Reply: 2



PostPosted: April 12, 2012 3:03 PM 

Bummer. Can't edit the first comment of a topic. The smiley face in the sample macro is the text "8 )".

Any imagej processing issues should be discussed on this topic.

dx


Posts: 1661

Reply: 3



PostPosted: April 12, 2012 10:33 PM 

hortonheardawho>>>

Thank you. I will print this out and work on it.

Please give me a bit of time...I'm in Montreal all day tomorrow Friday but will have the chance to read it thoroughly over the drive.

Can't wait to get into it.

yt
dx


Kevin Author Profile Page



Posts: no

Reply: 4



PostPosted: April 13, 2012 4:25 AM 

dx your a swat lol! Seriously great stuff, Horton is sure to put you through your paces!

Fred


Posts: 73

Reply: 5



PostPosted: April 13, 2012 5:59 AM 


Awsome Professor Hort.My first Mars processed image. I converted from tif to jpeg. Love that haze man. I will attempt to post link and start working on extra credit......

Fred


Posts: 73

Reply: 6



PostPosted: April 13, 2012 6:24 AM 


Homework L257

Fred


Posts: 73

Reply: 7



PostPosted: April 13, 2012 6:58 AM 


Wow Hort, this is way cool..extra credit!!

Fred


Posts: 73

Reply: 8



PostPosted: April 13, 2012 9:26 AM 


L257 false color, smoooothed by imageJ

hortonheardawho


Posts: 3465

Reply: 9



PostPosted: April 13, 2012 12:13 PM 

Fred, there is a permission problem on your server for the images - except for reply 7.

The others give a 403 error - Forbidden. You don't have permission to access /uploads/filename on this server.

You may have to flag the photos public.

Fred


Posts: 73

Reply: 10



PostPosted: April 13, 2012 1:24 PM 


Or this

L456
?ts=1334337423


L257

?ts=1334337423

L257 because i wanted to... ?ts=1334337424

Fred


Posts: 73

Reply: 11



PostPosted: April 13, 2012 1:31 PM 


Lets do that extra credit one more time....

?ts=1334338214

hortonheardawho


Posts: 3465

Reply: 12



PostPosted: April 13, 2012 2:26 PM 

Fred, I deleted the reply 10 with the broken links.

Why don't you create a Flickr account for your image sharing? The basic account is free and the interface is more user friendly - especially the sharing feature.

The download is simple and you have the added benefit of being able to add a long description of the image, make comments, add searchable tags, and link to other images in a variety of ways.

Did I mention it's free?

Fred


Posts: 73

Reply: 13



PostPosted: April 13, 2012 2:56 PM 

I hear ya brother. How could you tell I was using free services? lol, You giving out grades now or going to wait untill all the students have turned in thier homework?

Step it up guys this is big....

dx


Posts: 1661

Reply: 14



PostPosted: April 15, 2012 2:11 AM 

horton>>>

Here it is merged. Trust this paste works!!!This is all new to me.

yt
dx

dx


Posts: 1661

Reply: 15



PostPosted: April 15, 2012 2:27 AM 

try this one.

?t=1334471060

yt
dx

dx


Posts: 1661

Reply: 16



PostPosted: April 15, 2012 8:41 PM 

horton>>>

I went with 'flickr' first without success, then tried 'photobucket' for the final L456. Image a bit small but colors match your work.

I looked at the JPL Rover RAW images site and did not see the same dates you have as 2917...it only went to 2916...what gives?

Not only that but how do you find and name the images L-this or L-that? Do you require 3 images to make this work? OK, I know about RED GREEN and BLUE but where is that indicated on a B/W JPL image? This is where it gets a bit heavy for me to understand.

Can you describe that process a bit please? Thank you.

When I downloaded the 3 images in your 1st lead post there was not an 'L' number attached to each one...so when I first tried to merge the 3 pics I got some confusing colored images so I added the L4, L5 and L6 to the end of each image as described as such in your lead post so I could find them and place them in the correct placement on the colored merge Channels page. I trust I was able to do that without mucking the merge up!

The merge was successful as imaged in my 15.
It really surprised me at first to see them as one colored image.LOLOL

Thank you. Its a relief to process 1 image so far...as to your macro command lines I have no comment at the moment.

yt
dx

hortonheardawho


Posts: 3465

Reply: 17



PostPosted: April 15, 2012 9:57 PM 

dx, congratulations.

Sorry about the horrid Flickr file names. Flickr generates arbitrary file names for downloaded images. I should have linked the images to either Exploratorium files or the NASA MER site files. Both of them use names with the filter information coded into the image filename.

To share a Flickr file you have to copy the code in the "Share" pulldown button that is on the top left of the picture.

First, click on the "Share" button, then click on the "Grab the HTML/BBCode triangle, then select a convenient size ( I use Medium 500 a lot ), then select HTML for this blog and then select the code ( a single click on the code will select all of the code ) and then copy it ( ctl-c ) and then, finally, paste it ( ctl-v ) in the comment filed of this blog.

Er, the pancams have no Red, Green or Blue filters. What they have is a dog's breakfast of mostly narrow band filters named 1...8. The filters for the left and right pancams are, of course, different. Each filter is explained in this document in the section for character 25 ( Camera Filter ) of the Filename.

The filter map:

( R, G, B ) = ( L4, L5, L6 )

is the closest match to a "real" natural color - with some footnotes.

There are literally dozens of color maps that are commonly used.

Perhaps the most common is the "false color" map of:

( R, G, B ) = ( L2, L5, L7 )

Notice that the sundial color chips look quite different in "false color".

The companion right eye map is the synthetic color map:

( R, G, B ) = ( R3, avg(R1,R2), R1 ) -

with a hue shift. ( don't ask. )

or perhaps something more complicated, like my favorite:

( R, G, B ) = ( max( R3,R4,R5,R6,R7), avg( R1,R2), R1 )

( avg is the average image of two different images. )

Perhaps the most unusual is the "sunset" map:

( R, G, B ) = ( R4, avg( L7,R4), L7 )

In fact, some very strange combinations are used routinely:

( R, G, B ) = ( L2, avg(L2,L6), min(L6, L7))

is used for the miniTES calibration target.

In fact you can be creative and combine the filters any way you want to highlight certain minerals. Winston has played with Ratio color to highlight hematite signatures in the images.


Perhaps now is a good time to stop the lesson and wait for the "aha" moment from the students.

dx


Posts: 1661

Reply: 18



PostPosted: April 16, 2012 6:20 AM 

hortonheardawho>>>

I just got my 'aha' moment...LOLOLOLOLOL!!!and that was a hoot to discover...and it was, believe it or not, the meaning of the 'L' and 'R' cameras as they pertained to RGB.

I did not relate them that easily and it did not connect neuronically [new word], then I realized your favorites>>>[perhaps something more complicated, like my favorite:
( R, G, B ) = ( max( R3,R4,R5,R6,R7), avg( R1,R2), R1 )

What a challenging relief that that part is over!! I remember seeing that JPL site many many years ago -and more than likely you provided it then too- but I was not merging pics at that time it was just enough to see the great difficulty in identifying an image taken from so far away. Good thing we have 26 letters in our alphabet for a 27 number+letters pic from Mars.

If I can ask one Q at this time-I have to get this right as to what I may have garned from reading the JPL site where an example is given at the bottom.

Its mentioned that, 'taken by the left PANCAM through the 535nm (green) filter'. If I extrapolate this data then can I say this:
L5 with 535nm = Green, then L4 with 601nm = Red and L6 with 484nm = Blue? And the same for the corresponding [R] Right camera filters?

Your help is invaluable. Many thanks.

yt
dx


Fred


Posts: 73

Reply: 19



PostPosted: April 16, 2012 6:37 AM 


Im still here. Readin' and chewing gum....

hortonheardawho


Posts: 3465

Reply: 20



PostPosted: April 16, 2012 9:10 AM 

Readin' and chewin' at the same time! That's impressive! Sounds like you are ready for your next assignment: macros and plugins.

One of the powers of imagej is that image processing is easily captured, remembered and shared - no matter how complicated.

Your assignment is to record, save and post your processing steps for creating a synthetic color image using the map:

(R, G, B ) = ( R2, avg(R1,R2), R1 )

Assume that the order the files have been opened is R1, R2.

HINT: Put the images into a stack using the Image / Stacks / Images to Stack command and the Image / Stacks / Z Project... to create the "green" channel. ( Having the images in a stack allows you to process the images without having to refer to their names. ) Learn ALL the stack manipulation commands - including Add Slice.

Be sure to use the Windows command to select the image window you want to process if it is not the current window.

Use ONLY the menu items to process the images when you are creating a macro.

To start recording your processing steps select the Plugins / Macros / Record... menu item and when you are done recording just give the macro a name ( like R12 ) and save.

In the future you can use the saved macro by opening the new images you wish to process and select the menu item Plugins / Macros / Run... and navigate to your plugin. You may also install the macro if you plan on using it a few times during a processing session.

You can also edit the macro to "tweak" the processing. ( There is a macro programming language that allows more general processing. The macro in reply 0 uses several Macro Language features, as does this handy little macro I names 16BitStack:
------------------------

N=nImages;
i=1;
while(i<=N){
selectImage(i);
run("16-bit");
i++;
}
run("Images to Stack");
run("Multiply...", "stack value=255.000");
resetMinAndMax();

----------------------------

To a non-programmer I know all of this sounds intimidating - but it will save you a ton of time for routine processing.

***Note to Mark: Please fix the comment parser to stop processing between the tags code and pre. It is difficult ( but not impossible ) to include code fragments with < "less than" or > "greater than" or ) "right parenthesis" characters in the comments.

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 Next


Join the conversation:















Very Happy Smile Sad Surprised
Shocked Confused Cool Laughing
Mad Razz Embarassed Crying or Very Sad
Evil or Very Mad Twisted Evil Rolling Eyes Wink
Powered by MTSmileys