Posted by
Peter Haub on
Jan 08, 2016; 12:07pm
URL: http://imagej.273.s1.nabble.com/how-to-mark-single-pixel-in-a-overlay-tp5015334p5015346.html
Hello Jeremy,
not sure what your problem exactly is. I thought Volkers answers
describe the core solutions.
Be aware that makePoint() can deal with decimal numbers.
makePoint(203.5, 85.5) works well. Also makeRectangle(203.5, 85.5, 1, 1);
If you are looking for a way to interactively select a pixel and outline
it in the overlay then use the Point Selection Tool, select a point and
run the following macro to outline this pixel.
if (selectionType() == 10){
getSelectionBounds(x, y, w, h);
//print(""+x+" "+y+" "+w+" "+h);
makeRectangle(floor(x), floor(y), 1, 1);
Overlay.addSelection;
run("Select None");
}
Assign a shortcut to the macro for convenient handling.
Regards,
Peter
On 08.01.2016 10:43, Jeremy Adler wrote:
> Herbie and Volker,
> Thanks for responding.
>
> I appreciate that a pixel is a value in a array that makes up an image but in a zoomed image on a screen appears as a square of pixels with the same intensity.
>
> makePoint() only marks the top left of the zoomed pixel
>
> My point is that there seems to be no simple way of marking the version of the single pixel on the screen version of the image in a way that unambiguously identifies it - by outlining it. And it would be useful and plausible addition to the existing overlay options.
>
> There are complex ways of marking a single pixel - briefly give it value different from all other pixels, threshold it and create a ROI - this does outline the whole zoomed pixel, oddly unlike makePoint(), and afterwards restore the original value and convert ROI to an overlay. Or I could increase the size of image by replicating pixels and draw lines around the pixel. But these solutions lack elegance.
>
> Alternatively the pixel inspection tool mostly does what I want - to see pixel values in small area with the coordinates shown - is there a way within a macro to set the position and change this location of the centre of the Pixel Value window, or even to concurrently have more than one Pixel Value window running ?
>
> So really this is mostly plea for an additional overlay drawing option.
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Volker Baecker
> Sent: den 7 januari 2016 14:35
> To:
[hidden email]
> Subject: Re: how to mark single pixel in a overlay
>
> Hello,
> maybe you could use
>
> makePoint(x, y);
> Overlay.addSelection;
> run("Select None");
>
> to add a point selection to the overlay.
>
> Volker
>
>
> Jeremy Adler:
>> I am want to use the overlay to mark a single pixel in an image that has been zoomed to show individual pixels - within a macro.
>>
>> But I cannot see how to mark a single pixel in the overlay.
>> Overlay.drawRect marks an area of 2x2 pixels centred on my target pixel but 1x1
>> Overlay.drawLine with the two positions set the same, marks a single pixel offset
>>
>> I can mark a single pixel using the ROI manager and then move it and convert it to an overlay, but this seems unduly cumbersome, is there a better way of marking single pixels in a overlay ?
>>
>>
>> Dr Jeremy Adler
>> Senior res engineer
>> BioVis
>> Dag Hammarskjölds väg 20
>> Uppsala Universitet, 752 37 Uppsala ,Sweden
>>
>>
>>
>> +46 70 1679349
>>
>>
http://www.biovis.uu.se>>
>>
>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html