当前位置: 首页>>代码示例>>Java>>正文


Java Opener.openImage方法代码示例

本文整理汇总了Java中ij.io.Opener.openImage方法的典型用法代码示例。如果您正苦于以下问题:Java Opener.openImage方法的具体用法?Java Opener.openImage怎么用?Java Opener.openImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ij.io.Opener的用法示例。


在下文中一共展示了Opener.openImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openImage

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Open an image using ImageJ image reader.
 *
 * @param file image file.
 * @return read image
 * @throws IOException when image cannot be open.
 */
public static ImagePlus openImage(final File file) throws IOException {
    if (!file.exists()) {
        throw new IOException("Image does not exist: '" + file.getAbsolutePath() + "'.");
    }

    final Opener opener = new Opener();
    final ImagePlus imp = opener.openImage(file.getAbsolutePath());
    if (imp == null) {
        throw new IOException("Cannot open image: '" + file.getAbsolutePath() + "'.");
    }

    return imp;
}
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:21,代码来源:IOUtils.java

示例2: open

import ij.io.Opener; //导入方法依赖的package包/类
private synchronized void open(){
	Opener opener = new Opener();
	operand = opener.openImage(operandFileName);
	if (operand == null){
		RawDataOpener raw = RawDataOpener.getRawDataOpener();
		operand = raw.openImage(new File(operandFileName), raw.getFileInfo());
	}
	configured = true;
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:10,代码来源:ImageMathFilter.java

示例3: main

import ij.io.Opener; //导入方法依赖的package包/类
public static void main(String[] args) {
	CONRAD.setup();
	Opener op = new Opener();
	ImagePlus ip = op.openImage("C:\\Users\\Martin\\Documents\\MATLAB\\FastRadialSymmetry_PointPicker\\bla.tif");
	ip.show();
	FastRadialSymmetryTool frst = new FastRadialSymmetryTool();
	frst.setRadii(new double[]{3});
	frst.setAlpha(3);
	frst.setSmallGradientThreshold(0.02);
	frst.setConfigured(true);
	frst.setImageIndex(0);
	frst.applyToolToImage(ImageUtil.wrapImageProcessor(ip.getStack().getProcessor(1))).show();
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:14,代码来源:FastRadialSymmetryTool.java

示例4: loadImage

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Load image.
 *
 * @return the image plus
 */
public ImagePlus loadImage()
{
	if (!hasImage())
		return null;

	Opener opener = new Opener();
	opener.setSilentMode(true);

	// The tifPath may be a system resource or it may be a file 
	File file = new File(tifPath);
	if (file.exists())
	{
		// Load directly from a file path
		return opener.openImage(tifPath);
	}

	// IJ has support for loading TIFs from an InputStream
	Class<ConfigurationTemplate> resourceClass = ConfigurationTemplate.class;
	InputStream inputStream = resourceClass.getResourceAsStream(tifPath);
	if (inputStream != null)
	{
		return opener.openTiff(inputStream, Utils.removeExtension(file.getName()));
	}

	return null;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:32,代码来源:ConfigurationTemplate.java

示例5: openImage

import ij.io.Opener; //导入方法依赖的package包/类
public static ImagePlus openImage(String directory, String filename)
{
	if (filename == null)
		return null;
	Opener opener = new Opener();
	opener.setSilentMode(true);
	// TODO - Add support for loading custom channel, slice and frame using a filename suffix, e.g. [cCzZtT]
	// If the suffix exists, remove it, load the image then extract the specified slices.
	return opener.openImage(directory, filename);
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:11,代码来源:FindFoci.java

示例6: transformImageMacro

import ij.io.Opener; //导入方法依赖的package包/类
private static void transformImageMacro(String args[]) {
   // Read input parameters
   String fn_target=args[1];
   String fn_source=args[2];
   String fn_tnf   =args[3];
   String fn_out   =args[4];

   // Jpeg output
   String last_argument=args[args.length-1];
   boolean jpeg_output=last_argument.equals("-jpg_output");

   // Show parameters
   IJ.write("Target image           : "+fn_target);
   IJ.write("Source image           : "+fn_source);
   IJ.write("Transformation file    : "+fn_tnf);
   IJ.write("Output                 : "+fn_out);
   IJ.write("JPEG output            : "+jpeg_output);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);

   // Open source
   ImagePlus sourceImp;
   sourceImp=opener.openImage(fn_source);
   unwarpJImageModel source =
      new unwarpJImageModel(sourceImp.getProcessor(), false);
   source.setPyramidDepth(0);
   source.getThread().start();

   // Load transformation
   int intervals=unwarpJMiscTools.
      numberOfIntervalsOfTransformation(fn_tnf);
   double [][]cx=new double[intervals+3][intervals+3];
   double [][]cy=new double[intervals+3][intervals+3];
   unwarpJMiscTools.loadTransformation(fn_tnf, cx, cy);

   // Join threads
   try {
      source.getThread().join();
   } catch (InterruptedException e) {
      IJ.error("Unexpected interruption exception " + e);
   }

   // Apply transformation to source
   unwarpJMiscTools.applyTransformationToSource(
      sourceImp,targetImp,source,intervals,cx,cy);

   // Save results
   FileSaver fs=new FileSaver(sourceImp);
   if (jpeg_output) {
      JpegWriter js = new JpegWriter();
      js.setQuality(100);
      WindowManager.setTempCurrentImage(sourceImp);	
      js.run(fn_out);
   } else
      fs.saveAsTiff(fn_out);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:60,代码来源:UnwarpJ_.java

示例7: adaptCoefficientsCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to adapt coefficients to new image size. The factor between
 * the old and the new image size is expected to be a power of 2, positive
 * or negative (8, 4, 2, 0.5, 0.25, etc).
 *
 * @param args program arguments
 */
private static void adaptCoefficientsCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target         = args[1];
   String fn_source         = args[2];
   String fn_tnf            = args[3];
   String fn_out            = args[4];
   String sImageSizeFactor  = args[5];

   // Show parameters
   IJ.write("Target image                 : " + fn_target);
   IJ.write("Source image                 : " + fn_source);
   IJ.write("Input Transformation file    : " + fn_tnf);
   IJ.write("Output Transformation file   : " + fn_out);
   IJ.write("Image Size Factor            : " + sImageSizeFactor);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   BSplineModel source = new BSplineModel(sourceImp.getProcessor(), false, 1);
   source.setPyramidDepth(0);       
   source.startPyramids();

   // Load transformation
   int intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf);
   double [][]cx = new double[intervals+3][intervals+3];
   double [][]cy = new double[intervals+3][intervals+3];
   MiscTools.loadTransformation(fn_tnf, cx, cy);

   // Join threads
   try {
      source.getThread().join();
   } catch (InterruptedException e) {
      IJ.error("Unexpected interruption exception " + e);
   }

   // adapt coefficients.
   double dImageSizeFactor = Double.parseDouble(sImageSizeFactor);
   
   for(int i = 0; i < (intervals+3); i++)
       for(int j = 0; j < (intervals+3); j++)
       {
            cx[i][j] *= dImageSizeFactor;
            cy[i][j] *= dImageSizeFactor;
       }
   
   // Save transformation
   MiscTools.saveElasticTransformation(intervals, cx, cy, fn_out);
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:68,代码来源:bUnwarpJ_.java

示例8: elasticTransformImageCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to transform an image given an elastic deformation.
 *
 * @param args program arguments
 */
private static void elasticTransformImageCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf    = args[3];
   String fn_out    = args[4];

   // Show parameters
   IJ.write("Target image           : " + fn_target);
   IJ.write("Source image           : " + fn_source);
   IJ.write("Transformation file    : " + fn_tnf);
   IJ.write("Output:                : " + fn_out);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   BSplineModel source = null;

   source = new BSplineModel(sourceImp.getProcessor(), false, 1);
   source.setPyramidDepth(0);
   //source.startPyramids();
   source.startPyramids();
   

   // Load transformation
   int intervals=MiscTools.numberOfIntervalsOfTransformation(fn_tnf);
   double [][]cx=new double[intervals+3][intervals+3];
   double [][]cy=new double[intervals+3][intervals+3];
   MiscTools.loadTransformation(fn_tnf, cx, cy);

   // Join threads

   try {
	   source.getThread().join();
   } catch (InterruptedException e) {
	   IJ.error("Unexpected interruption exception " + e);
   }


   // Apply transformation to source
   //System.out.println("true");
   MiscTools.applyTransformationToSourceMT(
		   sourceImp, targetImp, source, intervals, cx, cy);

   // Save results
   FileSaver fs = new FileSaver(sourceImp);
   boolean ret = fs.saveAsTiff(fn_out);
   //boolean ret = fs.saveAsTiffStack(fn_out);
   if(ret == false)
	   System.out.println("Error when saving file " + fn_out);
   else
	   System.out.println("Saved file " + fn_out);
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:71,代码来源:bUnwarpJ_.java

示例9: rawTransformImageCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to transform an image given an raw deformation.
 *
 * @param args program arguments
 */
private static void rawTransformImageCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf    = args[3];
   String fn_out    = args[4];

   // Show parameters
   IJ.write("Target image           : " + fn_target);
   IJ.write("Source image           : " + fn_source);
   IJ.write("Transformation file    : " + fn_tnf);
   IJ.write("Output:                : " + fn_out);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   BSplineModel source = new BSplineModel(sourceImp.getProcessor(), false, 1);
   source.setPyramidDepth(0);
   //source.getThread().start();
   source.startPyramids();

   double [][]transformation_x = new double[targetImp.getHeight()][targetImp.getWidth()];
   double [][]transformation_y = new double[targetImp.getHeight()][targetImp.getWidth()];

   MiscTools.loadRawTransformation(fn_tnf, transformation_x, transformation_y);

   // Apply transformation
   MiscTools.applyRawTransformationToSource(sourceImp, targetImp, source, transformation_x, transformation_y);

   // Save results
   FileSaver fs = new FileSaver(sourceImp);
   boolean ret = fs.saveAsTiff(fn_out);
   if(ret == false)
	   System.out.println("Error when saving file " + fn_out);
   else
	   System.out.println("Saved file " + fn_out);
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:55,代码来源:bUnwarpJ_.java

示例10: compareElasticTransformationsCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to compare two opposite elastic deformations through the 
 * warping index.
 *
 * @param args program arguments
 */
private static void compareElasticTransformationsCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf_1   = args[3];
   String fn_tnf_2   = args[4];

   // Show parameters
   IJ.write("Target image                  : " + fn_target);
   IJ.write("Source image                  : " + fn_source);
   IJ.write("Target Transformation file    : " + fn_tnf_1);
   IJ.write("Source Transformation file    : " + fn_tnf_2);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   // First deformation.
   int intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf_2);

   double [][]cx_direct = new double[intervals+3][intervals+3];
   double [][]cy_direct = new double[intervals+3][intervals+3];

   MiscTools.loadTransformation(fn_tnf_2, cx_direct, cy_direct);      

   intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf_1);

   double [][]cx_inverse = new double[intervals+3][intervals+3];
   double [][]cy_inverse = new double[intervals+3][intervals+3];

   MiscTools.loadTransformation(fn_tnf_1, cx_inverse, cy_inverse);
   
   double warpingIndex = MiscTools.warpingIndex(sourceImp, targetImp, intervals, cx_direct, cy_direct, cx_inverse, cy_inverse);

   if(warpingIndex != -1)
       IJ.write(" Warping index = " + warpingIndex);             
   else
       IJ.write(" Warping index could not be evaluated because not a single pixel matched after the deformation!");             
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:57,代码来源:bUnwarpJ_.java

示例11: compareElasticRawTransformationsCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to compare an elastic deformation with a raw deformation
 * through the warping index (both transformations having same direction).
 *
 * @param args program arguments
 */
private static void compareElasticRawTransformationsCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf_elastic = args[3];
   String fn_tnf_raw     = args[4];

   // Show parameters
   IJ.write("Target image                  : " + fn_target);
   IJ.write("Source image                  : " + fn_source);
   IJ.write("Elastic Transformation file   : " + fn_tnf_elastic);
   IJ.write("Raw Transformation file       : " + fn_tnf_raw);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   int intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf_elastic);

   double [][]cx_direct = new double[intervals+3][intervals+3];
   double [][]cy_direct = new double[intervals+3][intervals+3];

   MiscTools.loadTransformation(fn_tnf_elastic, cx_direct, cy_direct);
  
   // We load the transformation raw file.
   double[][] transformation_x = new double[targetImp.getHeight()][targetImp.getWidth()];
   double[][] transformation_y = new double[targetImp.getHeight()][targetImp.getWidth()];
   MiscTools.loadRawTransformation(fn_tnf_raw, transformation_x, 
           transformation_y);
   
   double warpingIndex = MiscTools.rawWarpingIndex(sourceImp, targetImp, 
           intervals, cx_direct, cy_direct, transformation_x, transformation_y);

   if(warpingIndex != -1)
       IJ.write(" Warping index = " + warpingIndex);             
   else
       IJ.write(" Warping index could not be evaluated because not a single pixel matched after the deformation!");             
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:56,代码来源:bUnwarpJ_.java

示例12: compareRawTransformationsCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to compare two raw deformations through the warping index
 * (both transformations having same direction).
 *
 * @param args program arguments
 */
private static void compareRawTransformationsCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf_1   = args[3];
   String fn_tnf_2   = args[4];

   // Show parameters
   IJ.write("Target image                  : " + fn_target);
   IJ.write("Source image                  : " + fn_source);
   IJ.write("Target Transformation file    : " + fn_tnf_1);
   IJ.write("Source Transformation file    : " + fn_tnf_2);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   // We load the transformation raw file.
   double[][] transformation_x_1 = new double[targetImp.getHeight()][targetImp.getWidth()];
   double[][] transformation_y_1 = new double[targetImp.getHeight()][targetImp.getWidth()];
   MiscTools.loadRawTransformation(fn_tnf_1, transformation_x_1, transformation_y_1);
   
   // We load the transformation raw file.
   double[][] transformation_x_2 = new double[targetImp.getHeight()][targetImp.getWidth()];
   double[][] transformation_y_2 = new double[targetImp.getHeight()][targetImp.getWidth()];
   MiscTools.loadRawTransformation(fn_tnf_2, transformation_x_2, transformation_y_2);
   
   double warpingIndex = MiscTools.rawWarpingIndex(sourceImp, targetImp, 
           transformation_x_1, transformation_y_1, transformation_x_2, transformation_y_2);

   if(warpingIndex != -1)
       IJ.write(" Warping index = " + warpingIndex);             
   else
       IJ.write(" Warping index could not be evaluated because not a single pixel matched after the deformation!");            
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:53,代码来源:bUnwarpJ_.java

示例13: convertToRawTransformationCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to convert an elastic deformations into raw format.
 *
 * @param args program arguments
 */
private static void convertToRawTransformationCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf_elastic = args[3];
   String fn_tnf_raw     = args[4];
   

   // Show parameters
   IJ.write("Target image                      : " + fn_target);
   IJ.write("Source image                      : " + fn_source);
   IJ.write("Input Elastic Transformation file : " + fn_tnf_elastic);
   IJ.write("Ouput Raw Transformation file     : " + fn_tnf_raw);

   // Open target
   Opener opener = new Opener();
   ImagePlus targetImp;
   targetImp = opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   int intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf_elastic);

   double [][]cx = new double[intervals+3][intervals+3];
   double [][]cy = new double[intervals+3][intervals+3];

   MiscTools.loadTransformation(fn_tnf_elastic, cx, cy);
   
   
   // We load the transformation raw file.
   double[][] transformation_x = new double[targetImp.getHeight()][targetImp.getWidth()];
   double[][] transformation_y = new double[targetImp.getHeight()][targetImp.getWidth()];
   
   MiscTools.convertElasticTransformationToRaw(targetImp, intervals, cx, cy, transformation_x, transformation_y); 
   
   MiscTools.saveRawTransformation(fn_tnf_raw, targetImp.getWidth(), targetImp.getHeight(), transformation_x, transformation_y);
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:51,代码来源:bUnwarpJ_.java

示例14: composeRawTransformationsCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to compose two raw deformations.
 *
 * @param args program arguments
 */
private static void composeRawTransformationsCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf_raw_1   = args[3];
   String fn_tnf_raw_2   = args[4];
   String fn_tnf_raw_out = args[5];
   

   // Show parameters
   IJ.write("Target image                      : " + fn_target);
   IJ.write("Source image                      : " + fn_source);
   IJ.write("Input Raw Transformation file 1   : " + fn_tnf_raw_1);
   IJ.write("Input Raw Transformation file 2   : " + fn_tnf_raw_2);
   IJ.write("Output Raw Transformation file    : " + fn_tnf_raw_out);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   // We load the first transformation raw file.
   double[][] transformation_x_1 = new double[targetImp.getHeight()][targetImp.getWidth()];
   double[][] transformation_y_1 = new double[targetImp.getHeight()][targetImp.getWidth()];
   MiscTools.loadRawTransformation(fn_tnf_raw_1, transformation_x_1, transformation_y_1);
          
   // We load the second transformation raw file.
   double[][] transformation_x_2 = new double[targetImp.getHeight()][targetImp.getWidth()];
   double[][] transformation_y_2 = new double[targetImp.getHeight()][targetImp.getWidth()];
   MiscTools.loadRawTransformation(fn_tnf_raw_2, transformation_x_2, transformation_y_2);
   
   double [][] outputTransformation_x = new double[targetImp.getHeight()][targetImp.getWidth()];
   double [][] outputTransformation_y = new double[targetImp.getHeight()][targetImp.getWidth()];
         
   // Now we compose them and get as result a raw transformation mapping.
   MiscTools.composeRawTransformations(targetImp.getWidth(), targetImp.getHeight(), 
           transformation_x_1, transformation_y_1, transformation_x_2, transformation_y_2, 
           outputTransformation_x, outputTransformation_y);
          
   MiscTools.saveRawTransformation(fn_tnf_raw_out, targetImp.getWidth(), 
           targetImp.getHeight(), outputTransformation_x, outputTransformation_y);
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:58,代码来源:bUnwarpJ_.java

示例15: composeElasticTransformationsCommandLine

import ij.io.Opener; //导入方法依赖的package包/类
/**
 * Method to compose two elastic deformations.
 *
 * @param args program arguments
 */
private static void composeElasticTransformationsCommandLine(String args[]) 
{
   // Read input parameters
   String fn_target = args[1];
   String fn_source = args[2];
   String fn_tnf_elastic_1   = args[3];
   String fn_tnf_elastic_2   = args[4];
   String fn_tnf_raw = args[5];
   

   // Show parameters
   IJ.write("Target image                        : " + fn_target);
   IJ.write("Source image                        : " + fn_source);
   IJ.write("Input Elastic Transformation file 1 : " + fn_tnf_elastic_1);
   IJ.write("Input Elastic Transformation file 2 : " + fn_tnf_elastic_2);
   IJ.write("Output Raw Transformation file      : " + fn_tnf_raw);

   // Open target
   Opener opener=new Opener();
   ImagePlus targetImp;
   targetImp=opener.openImage(fn_target);
   if(targetImp == null)
       IJ.error("\nError: " + fn_target + " could not be opened\n");

   // Open source
   ImagePlus sourceImp;
   sourceImp = opener.openImage(fn_source);
   if(sourceImp == null)
       IJ.error("\nError: " + fn_source + " could not be opened\n");
   
   int intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf_elastic_1);

   double [][]cx1 = new double[intervals+3][intervals+3];
   double [][]cy1 = new double[intervals+3][intervals+3];

   MiscTools.loadTransformation(fn_tnf_elastic_1, cx1, cy1);

   intervals = MiscTools.numberOfIntervalsOfTransformation(fn_tnf_elastic_2);

   double [][]cx2 = new double[intervals+3][intervals+3];
   double [][]cy2 = new double[intervals+3][intervals+3];

   MiscTools.loadTransformation(fn_tnf_elastic_2, cx2, cy2);
   
   double [][] outputTransformation_x = new double[targetImp.getHeight()][targetImp.getWidth()];
   double [][] outputTransformation_y = new double[targetImp.getHeight()][targetImp.getWidth()];
         
   // Now we compose them and get as result a raw transformation mapping.
   MiscTools.composeElasticTransformations(targetImp, intervals, 
           cx1, cy1, cx2, cy2, outputTransformation_x, outputTransformation_y);
   
   
   MiscTools.saveRawTransformation(fn_tnf_raw, targetImp.getWidth(), 
           targetImp.getHeight(), outputTransformation_x, outputTransformation_y);       
   
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:62,代码来源:bUnwarpJ_.java


注:本文中的ij.io.Opener.openImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。