Copy a ROI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Copy a ROI

Nikos Katsikanis
I want to create a Roi interest in the plugin code. I then want to make a
new imagePlus withthese pixels. However in the new image I always get the
ROI pixels starting from x = 0 and y = 0 . in the following code,



r = new Rectangle(200,200, 500, 500);
  ip.setRoi(r);
 
  rectangle = ip.getRoi();
   ipW = (int)rectangle .getWidth();
   ipH = (int)rectangle .getHeight();

   ImagePlus image = NewImage.createByteImage("1", ipW, ipH,
    1, NewImage.FILL_BLACK);
  ImageProcessor ip2 = image.getProcessor();
  ip2.copyBits(ip, 0, 0, Blitter.COPY);
  splitRight.show();


what I want is another image 500 x 500 showing the pixels in the rectangle ie
(x range 200 - 700)
(y range 200 - 700)

. what I get  is a pixture with the Roi (0, 0, 300,300) from the original
picture ie

could anyone explain this please.