3D Objects Counter - problem with numbers in image

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

3D Objects Counter - problem with numbers in image

Chandler, Kathy
Hi

I am a PhD student at Lancaster University investigating the influence of tree species on certain soil properties. I am trying  to use ImageJ/Fiji to analyse some CT images of soil cores. I am interested in analysing the soil pores that are connected to the boundary of the image stack, because they are hydrologically relevant, and want to exclude everything else. I have tried doing this as follows:

1)      Inverting the thresholded binary images so that the pore spaces are viewed as the objects;

2)      using the 3D objects counter to exclude everything connected to the boundary;

3)      converting this image to binary;

4)      using the image calculator to subtract this image stack from the original.

As far as I know the 3D objects counter is the only plugin that separates objects connected to the boundary from those that aren't but, unfortunately, the numbers that it produces in the output image are then also treated as pore space. I found the 3D objects counter source code by using the Scripting>Open source for menu item plugin and am trying to create my own plugin that doesn't show the numbers. I've identified the ShowNb variable as the one that determines if the numbers are shown (please correct me if that's wrong). I then created my own plugin by copying the original source code, setting ShowNb to false, changing the name of the plugin to Exclude_Connected_Objects and compiling it, but I end up with the following compilation errors:


C:\Users\User's files\Computer Programming\Exclude_Connected_Objects.java:134: cannot find symbol
symbol  : method addFocusListener(Exclude_Connected_Objects)
location: class TextField
        ((TextField)values.elementAt(0)).addFocusListener(this);
                                        ^
C:\Users\User's files\Computer Programming\Exclude_Connected_Objects.java:135: cannot find symbol
symbol  : method addFocusListener(Exclude_Connected_Objects)
location: class TextField
        ((TextField)values.elementAt(1)).addFocusListener(this);
                                        ^
2 errors


I've never programmed in Java before and am completely stuck with this. Can anyone help?

Thanks

Kathy
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: 3D Objects Counter - problem with numbers in image

Michael Schmid
Hi Cathy,

maybe you have forgotten to implement FocusListener in your Exclude_Connected_Objects class (the one that 'this' refers to)?

Michael
________________________________________________________________

On Apr 17, 2013, at 10:52, Chandler, Kathy wrote:

> Hi
>
> I am a PhD student at Lancaster University investigating the influence of tree species on certain soil properties. I am trying  to use ImageJ/Fiji to analyse some CT images of soil cores. I am interested in analysing the soil pores that are connected to the boundary of the image stack, because they are hydrologically relevant, and want to exclude everything else. I have tried doing this as follows:
>
> 1)      Inverting the thresholded binary images so that the pore spaces are viewed as the objects;
>
> 2)      using the 3D objects counter to exclude everything connected to the boundary;
>
> 3)      converting this image to binary;
>
> 4)      using the image calculator to subtract this image stack from the original.
>
> As far as I know the 3D objects counter is the only plugin that separates objects connected to the boundary from those that aren't but, unfortunately, the numbers that it produces in the output image are then also treated as pore space. I found the 3D objects counter source code by using the Scripting>Open source for menu item plugin and am trying to create my own plugin that doesn't show the numbers. I've identified the ShowNb variable as the one that determines if the numbers are shown (please correct me if that's wrong). I then created my own plugin by copying the original source code, setting ShowNb to false, changing the name of the plugin to Exclude_Connected_Objects and compiling it, but I end up with the following compilation errors:
>
>
> C:\Users\User's files\Computer Programming\Exclude_Connected_Objects.java:134: cannot find symbol
> symbol  : method addFocusListener(Exclude_Connected_Objects)
> location: class TextField
>        ((TextField)values.elementAt(0)).addFocusListener(this);
>                                        ^
> C:\Users\User's files\Computer Programming\Exclude_Connected_Objects.java:135: cannot find symbol
> symbol  : method addFocusListener(Exclude_Connected_Objects)
> location: class TextField
>        ((TextField)values.elementAt(1)).addFocusListener(this);
>                                        ^
> 2 errors
>
>
> I've never programmed in Java before and am completely stuck with this. Can anyone help?
>
> Thanks
>
> Kathy
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: 3D Objects Counter - problem with numbers in image

Michael Doube-4
In reply to this post by Chandler, Kathy
Hi Kathy,

I think you were really close, but subtraction is not the right operation. You want logical XOR.

The particle counter in BoneJ can exclude on edges too. Binarize your input image so that pore space is foreground (255). Run the particle analyser with exclude on edges checked and the measurement options unchecked and the particle image output option checked. Threshold the resulting particle image to include everything 1 and greater, those are your non-boundary particles.

http://bonej.org/particles

Now you need to do a logical calculation which says, 'keep all the pixels which are not foreground in both images'. Subtraction will not do this because it will try to subtract 255 from 0, and that will break. So, instead use XOR, which will pick out the boundary particles, which are the only difference between the input image (all particles) and processed image (all particles except boundary particles).

Cheers,

Michael

--
Dr Michael Doube
BPhil BVSc PhD MRCVS
Lecturer, Comparative Biomedical Sciences
The Royal Veterinary College
London NW1 0TU
United Kingdom

+44 (0)20 7121 1903 (Internal: 5503)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Chandler, Kathy [[hidden email]]
Sent: 17 April 2013 09:52
To: [hidden email]
Subject: 3D Objects Counter - problem with numbers in image

Hi

I am a PhD student at Lancaster University investigating the influence of tree species on certain soil properties. I am trying  to use ImageJ/Fiji to analyse some CT images of soil cores. I am interested in analysing the soil pores that are connected to the boundary of the image stack, because they are hydrologically relevant, and want to exclude everything else. I have tried doing this as follows:

1)      Inverting the thresholded binary images so that the pore spaces are viewed as the objects;

2)      using the 3D objects counter to exclude everything connected to the boundary;

3)      converting this image to binary;

4)      using the image calculator to subtract this image stack from the original.

As far as I know the 3D objects counter is the only plugin that separates objects connected to the boundary from those that aren't but, unfortunately, the numbers that it produces in the output image are then also treated as pore space. I found the 3D objects counter source code by using the Scripting>Open source for menu item plugin and am trying to create my own plugin that doesn't show the numbers. I've identified the ShowNb variable as the one that determines if the numbers are shown (please correct me if that's wrong). I then created my own plugin by copying the original source code, setting ShowNb to false, changing the name of the plugin to Exclude_Connected_Objects and compiling it, but I end up with the following compilation errors:


C:\Users\User's files\Computer Programming\Exclude_Connected_Objects.java:134: cannot find symbol
symbol  : method addFocusListener(Exclude_Connected_Objects)
location: class TextField
        ((TextField)values.elementAt(0)).addFocusListener(this);
                                        ^
C:\Users\User's files\Computer Programming\Exclude_Connected_Objects.java:135: cannot find symbol
symbol  : method addFocusListener(Exclude_Connected_Objects)
location: class TextField
        ((TextField)values.elementAt(1)).addFocusListener(this);
                                        ^
2 errors


I've never programmed in Java before and am completely stuck with this. Can anyone help?

Thanks

Kathy
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
[http://www.rvc.ac.uk/cf_images/button_rvc.png]<http://www.rvc.ac.uk>    [http://www.rvc.ac.uk/cf_images/button_twitter.png] <http://twitter.com/RoyalVetCollege>     [http://www.rvc.ac.uk/cf_images/button_facebook.png] <http://www.facebook.com/theRVC>

This message, together with any attachments, is intended for the stated addressee(s) only and may contain privileged or confidential information. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Royal Veterinary College (RVC). If you are not the intended recipient, please notify the sender and be advised that you have received this message in error and that any use, dissemination, forwarding, printing, or copying is strictly prohibited. Unless stated expressly in this email, this email does not create, form part of, or vary any contractual or unilateral obligation. Email communication cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, amended, lost, destroyed, incomplete or contain viruses. Therefore, we do not accept liability for any such matters or their consequences. Communication with us by email will be taken as acceptance of the risks inherent in doing so.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html