Author Topic: Surfer script to convert grid images for imagej  (Read 2749 times)

Ben Buse

  • Professor
  • ****
  • Posts: 405
Surfer script to convert grid images for imagej
« on: May 19, 2016, 08:55:31 pm »
Hi,

I've attached a script (modified from scripts on surfer website) which converts all the grid files within a folder into .img files -these files can by opened in imagej (including by dragging on to imagej) - a hdr file is also created which must be kept in the same folder.



To use the script - change the file_directory to folder with grid files and file_directory2 to output directory.

For file_directory2 it must end with \" e.g "D:\example\" and NOT "D:\example"

Ben
« Last Edit: July 03, 2017, 05:10:57 am by Ben Buse »

Probeman

  • Emeritus
  • *****
  • Posts: 1875
  • Never sleeps...
    • John Donovan
Re: Surfer script to convert grid images for imagej
« Reply #1 on: May 21, 2016, 03:55:07 am »
I've attached a script (modified from scripts on surfer website) which converts all the grid files within a folder into .img files -these files can by opened in imagej (including by dragging on to imagej) - a hdr file is also created which must be kept in the same folder.

Hi Ben,
This is very cool.   I've used ImageJ to make stacks of images for GIF animations, like those here, but what do you use ImageJ for?

http://probesoftware.com/smf/index.php?topic=44.msg527#msg527

Also, I am no expert in Python, but does this Python script have to be run from the Python environment or can you make an executable and add some buttons that pull up an open/save file dialog for the user?  So the user doesn't have to edit the script themselves.  I think it would be even cooler...
« Last Edit: May 21, 2016, 03:56:38 am by Probeman »
The only stupid question is the one not asked!

Ben Buse

  • Professor
  • ****
  • Posts: 405
Re: Surfer script to convert grid images for imagej
« Reply #2 on: May 23, 2016, 04:25:25 am »
Hi John,

Its a surfer script.

We regularly use imagej stacks of images to (1) measure concentrations of different phases; (2) plot broad line scans (averaged perpendicular to linescan) and (3) calculate errors and detection limits for different numbers of pixels summed.

It also has various image alignment plugins which are useful when there is shift between the 1st and 2nd pass off an element map - when using > 5 elements on WDS for high resolution maps, FOV 10-100 um.

Ben
« Last Edit: May 23, 2016, 04:40:09 am by Ben Buse »

Ben Buse

  • Professor
  • ****
  • Posts: 405
Re: Surfer script to convert grid images for imagej
« Reply #3 on: July 27, 2016, 11:51:15 am »
Hi,

I've now created a python script to convert directly from prbimg file to a comma seperated text file which imagej can open by using import text image.

I've attached the python script and it compiled as a program so that you don't need python installed


Gseward

  • Global Moderator
  • Professor
  • *****
  • Posts: 128
Re: Surfer script to convert grid images for imagej
« Reply #4 on: June 29, 2017, 10:10:07 am »
Ben,

Thanks a lot for making this available. When all that is needed is a 32bit raw intensity image, your code is very useful for avoiding tedious usage of Calc Image and Surfer.

Cheers,

Gareth

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2426
  • Other duties as assigned...
    • Probe Software
Re: Surfer script to convert grid images for imagej
« Reply #5 on: June 30, 2017, 09:19:00 am »
Ben,

Thanks a lot for making this available. When all that is needed is a 32bit raw intensity image, your code is very useful for avoiding tedious usage of Calc Image and Surfer.

Cheers,

Gareth

By the way, Paul Carpenter says that this "stitch" plugin for ImageJ :

https://imagej.net/Image_Stitching#Grid_Collection.2FStitching_plugin

accepts not only TIF but also BMP files as input. The "mosaic" acquisition feature in Stage.exe as described here:

http://probesoftware.com/smf/index.php?topic=324.msg6078#msg6078

produces both GRD (for Surfer) and BMP files as mosaic (grid) output.  So these BMP files can now be used by the ImageJ sticth plugin now that the Stage.exe mosaic acqusition order (for both JEOL and Cameca instruments) is always left to right and top to bottom (right and down).
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"