Skip to content

Instantly share code, notes, and snippets.

@mhl
Created June 25, 2010 13:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mhl/452826 to your computer and use it in GitHub Desktop.
--- Polar_Transformer.original.java 2008-03-10 21:52:08.000000000 +0100
+++ Polar_Transformer.java 2010-06-25 15:27:13.171811587 +0200
@@ -73,37 +73,56 @@
if (showDialog(ipInitial))
{
-
- widthInitial = ipInitial.getWidth();
- heightInitial = ipInitial.getHeight();
- if (ipInitial instanceof ColorProcessor) isColor = true;
-
- if (toPolar)
- {
- title = "Polar Transform of "+iInitial.getTitle();
- if(polar180) angleLines = 180;
- else angleLines = 360;
- if(!defaultLines) getLines();
- if (polar180) polar180();
- else polar360();
- }
- else
- {
- title = "Cartesian Transform of "+iInitial.getTitle();
- if (polar180) cart180();
- else cart360();
- }
-
- // Copy settings from the original to the transformed image:
- ipTransform.setMinAndMax(ipInitial.getMin (), ipInitial.getMax ());
- ipTransform.setCalibrationTable (ipInitial.getCalibrationTable ());
- iTransform = new ImagePlus(title, ipTransform);
- iTransform.setCalibration (iInitial.getCalibration());
- iTransform.show();
+ iTransform = exec(iInitial);
+ iTransform.show();
}
}
+ public ImagePlus exec(ImagePlus inputImage)
+ {
+ widthInitial = ipInitial.getWidth();
+ heightInitial = ipInitial.getHeight();
+ if (ipInitial instanceof ColorProcessor) isColor = true;
+
+ if (toPolar)
+ {
+ title = "Polar Transform of "+iInitial.getTitle();
+ if(polar180) angleLines = 180;
+ else angleLines = 360;
+ if(!defaultLines) getLines();
+ if (polar180) polar180();
+ else polar360();
+ }
+ else
+ {
+ title = "Cartesian Transform of "+iInitial.getTitle();
+ if (polar180) cart180();
+ else cart360();
+ }
+
+ // Copy settings from the original to the transformed image:
+ ipTransform.setMinAndMax(ipInitial.getMin (), ipInitial.getMax ());
+ ipTransform.setCalibrationTable (ipInitial.getCalibrationTable ());
+ iTransform = new ImagePlus(title, ipTransform);
+ iTransform.setCalibration (iInitial.getCalibration());
+ return iTransform;
+ }
+
+ public ImagePlus exec(ImagePlus input,
+ boolean toPolar,
+ boolean polar180,
+ boolean defaultCenter,
+ boolean defaultLines,
+ boolean clockWise)
+ {
+ this.toPolar = toPolar;
+ this.polar180 = polar180;
+ this.defaultCenter = defaultCenter;
+ this.defaultLines = defaultLines;
+ this.clockWise = clockWise;
+ return exec(input);
+ }
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- polar180()
public void polar180()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment