select a specific 16 bit grayscale intensity for filling a ROI

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

select a specific 16 bit grayscale intensity for filling a ROI

Gabriel Acevedo
Hello,
  I am trying to fill a ROI in a stack of 16 bit DICOM images with a
specific grayscale value, but in the 16bit range. The default color picker
only gives an 8-bit range. Is there a way to assign a specific fill "color"
outside of the 0-256 range? I've tried selecting the 8-bit "equivalent" but
it is not translating into 16 bits too well.
Thanks in Advance,

Gabriel Acevedo-Bolton
Reply | Threaded
Open this post in threaded view
|

Re: select a specific 16 bit grayscale intensity for filling a ROI

Wayne Rasband
> Hello,
>   I am trying to fill a ROI in a stack of 16 bit DICOM images
> with a specific grayscale value, but in the 16bit range. The
> default color picker only gives an 8-bit range. Is there a way
> to assign a specific fill "color" outside of the 0-256 range?
> I've tried selecting the 8-bit "equivalent" but it is not
> translating into 16 bits too well.

This macro fills the ROI in all images in a stack with the value 1234.

   setColor(1234);
   for (i=1; i<=nSlices; i++) {
       setSlice(i);
       fill();
   }

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: select a specific 16 bit grayscale intensity for filling a ROI

Jerome Mutterer
In reply to this post by Gabriel Acevedo
Gabriel,

You can install the following tool macroset. Double click on it's icon  
to set the fill value, then click on the image to fill it. If a Roi is  
active it will be filled.

Jerome.


// fill image or ROI with specified value.

var value=100;

macro "Fill16bits Tool -  
C000D08D09D17D1aD26D2bD31D32D33D34D35D3cD40D44D4dD50D53D57D5dD61D62D63D64D65D66D68D6cD73D77D7bD84D8aD8cD94D95D99D9bD9cD9dD9eD9fDa5Da6Da7Da8Da9DaaDb6Db7Db8Db9DbcDbdDbeDcbDcdDcfDde"{
setColor(value);
fill();
}

macro "Fill16bits Tool Options" {
value = getNumber("Fill value ",value);
}

Quoting Gabriel Acevedo <[hidden email]>:

> Hello,
>   I am trying to fill a ROI in a stack of 16 bit DICOM images with a
> specific grayscale value, but in the 16bit range. The default color picke=
> r
> only gives an 8-bit range. Is there a way to assign a specific fill "colo=
> r"
> outside of the 0-256 range? I've tried selecting the 8-bit "equivalent" b=
> ut
> it is not translating into 16 bits too well.
> Thanks in Advance,
>
> Gabriel Acevedo-Bolton
>
Reply | Threaded
Open this post in threaded view
|

Re: select a specific 16 bit grayscale intensity for filling a ROI

Jonathan Jackson-2
In reply to this post by Gabriel Acevedo
Jerome,
This tool will be very useful indeed, thanks for submitting it.  Others
installing this tool may wish to enable the 'Undo' function. I also added
introduced the calibrate() function in order to work with signed 16 bit
images. The modified macro is:

var value=100;
macro "Fill16bits Tool -
C000D08D09D17D1aD26D2bD31D32D33D34D35D3cD40D44D4dD50D53D57D5dD61D62D63D64D65D66D68D6cD73D77D7bD84D8aD8cD94D95D99D9bD9cD9dD9eD9fDa5Da6Da7Da8Da9DaaDb6Db7Db8Db9DbcDbdDbeDcbDcdDcfDde"{
setupUndo();                     // requires 1.32g
setColor(value - calibrate(0));  // calibrate Requires 1.34h.
fill();
}

I also have a comment for Wayne - when the cursor moves over an ROI, the
icon changes (I see it change from a cross-hair to a pointer) indicating
that the tool operates on the ROI.  This is appropriate for the ROI editing
tools, but I'd like to be able to keep the cross cursor for a tool such as
this which draws on the image.  Would it be possible to add a macro / tool
function which sets whether or not the pointer changes within an ROI?

Thanks,
Jon

>Gabriel,
>
>You can install the following tool macroset. Double click on it's icon
>to set the fill value, then click on the image to fill it. If a Roi is
>active it will be filled.
>
>Jerome.
>
>
>// fill image or ROI with specified value.
>
>var value=100;
>
>macro "Fill16bits Tool -
>C000D08D09D17D1aD26D2bD31D32D33D34D35D3cD40D44D4dD50D53D57D5dD61D62D63D64D65D66D68D6cD73D77D7bD84D8aD8cD94D95D99D9bD9cD9dD9eD9fDa5Da6Da7Da8Da9DaaDb6Db7Db8Db9DbcDbdDbeDcbDcdDcfDde"{
>setColor(value);
>fill();
>}
>
>macro "Fill16bits Tool Options" {
>value = getNumber("Fill value ",value);
>}
>
Reply | Threaded
Open this post in threaded view
|

Re: select a specific 16 bit grayscale intensity for filling a ROI

Wayne Rasband
> Jerome,
> This tool will be very useful indeed, thanks for submitting it.
> Others installing this tool may wish to enable the 'Undo' function.
> I also added introduced the calibrate() function in order to work
> with signed 16 bit images. The modified macro is:
>
> var value=100;
> macro "Fill16bits Tool -
> C000D08D09D17D1aD26D2bD31D32D33D34D35D3cD40D44D4dD50D53D57D5dD61D62D63D
> 64D65D66D68D6cD73D77D7bD84D8aD8cD94D95D99D9bD9cD9dD9eD9fDa5Da6Da7Da8Da9
> DaaDb6Db7Db8Db9DbcDbdDbeDcbDcdDcfDde"{
> setupUndo();                     // requires 1.32g
> setColor(value - calibrate(0));  // calibrate Requires 1.34h.
> fill();
> }

This should be changed to setColor(value) with ImageJ 1.37e or later,  
which fixes setColor() so it works with signed 16-bit images.

> I also have a comment for Wayne - when the cursor moves over
> an ROI, the icon changes (I see it change from a cross-hair
> to a pointer) indicating that the tool operates on the ROI.
> This is appropriate for the ROI editing tools, but I'd like
> to be able to keep the cross cursor for a tool such as this
> which draws on the image.  Would it be possible to add a
> macro / tool function which sets whether or not the pointer
> changes within an ROI?

With ImageJ 1.37h and later,  the cursor does not change shape when it  
is over an ROI if you are using a macro tool.

-wayne