Posicionar origem xy 0,0 no centro da Imagem API imageJ

0 respostas
JavaX_JavaX

Bom dia!

Pessoal preciso de uma ajuda.

é meu primeiro trabalho com processamento de imagem e preciso colocar as escalas X,Y com as coordenadas 0,0 no centro da imagem, obs: estou Usando a Api ImageJ, Abaixo segue uma parte do Código

public void Teste1autoCenter(ImagePlus imp) {

        String Pasta        =  "C:\\temp\\";  
        String Nome         =  "TesCenter";  
        String Tipo         =  "tif";  
        ImagePlus  imp1, imp2, imp3, imp4 = null;
        utilidades = new Utilidades();
        
        ImageProcessor ip = imp.getProcessor();
        

       imp1 = new Duplicator().run(imp);
       imp1.setTitle("Media.tif");
       imp1.setRoi(0, 0, 1388, 1028);
       IJ.run(imp1, "Mean...", "radius=100");
       imp1.show();
  
       imp2 = new Duplicator().run(imp);
       imp2.setTitle("Center.tif");
       imp2.setRoi(0, 0, 1388, 1028);
       IJ.run(imp2, "Median...", "radius=4");
       imp2.show();
  
       ImageCalculator ic = new ImageCalculator();
       imp3 = ic.run("Subtract create", imp1, imp2);
       imp3.show();

       //metodo abaixo Visualiza a posição X,Y e volume do Pixels
       utilidades.mostraPixels(imp3);
       
       //imp3.getCanvas().bounds();
        
       
       Double pixelWidth   =  0.02209940014051241;
       Double pixelHeight  =  0.02209940014051241; 
       Double pixelDepth   =  1.0;
       Double xOrigin      =  691.0; 
       Double yOrigin      =  524.0; 

       /*        
       Double pixelWidth   =  0.02209940014051241;
       Double pixelHeight  =  0.02209940014051241; 
       Double pixelDepth   =  1.0;
       Double xOrigin      =  691.0; 
       Double yOrigin      =  524.0; 
       */  
   
   
       ip.drawRect(242, 75, 900, 900); 
       ip.drawRect(464, 297, 455, 455); 
       ip.drawLine(242, 75, 1140, 975);
       ip.drawLine(242, 975, 1140, 75);

       
       
       Double scaleX = pixelWidth;
       Double scaleY = pixelHeight;
       Double depth =  pixelDepth; 
       Double centerX = xOrigin; 
       Double centerY = yOrigin; 
        
       System.out.println(scaleX+" "+scaleY+" "+depth+" "+centerX+" "+centerY);

       
       IJ.run(imp, "Properties...", "channels=1 slices=1 frames=1 unit=cm pixel_width="+scaleX+" pixel_height="+scaleY+" voxel_depth="+depth+" frame=[0 sec] origin="+centerX+","+centerY);

       IJ.run(imp, "Find Maxima...", "noise=20 output=List light");
       IJ.saveAs("Results", "C:\\Temp\\Results.txt");
       //IJ.run(imp, "Save", "save="+Pasta+Nome+"."+Tipo);
       imp.show();

  }

caso alguém tiver alguma ideia, e puder me ajudar fico Grato

Att JavaX

Criado 21 de outubro de 2014
Respostas 0
Participantes 1