[Insight-users] co-occurrence matrix

Glenn Pierce glennpierce@connectfree.co.uk
Fri May 21 12:27:50 EDT 2004


--=-n2AKiUZvoYtHgxNNkoWo
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi

I have a nice image displaying now.

I am scaling to  255 intensity values with
shift->SetOutputScalarTypeToUnsignedChar();
                                            
I get  nice image with

  imageMapper->SetColorWindow(8);
  imageMapper->SetColorLevel(4);

I must confess I don't understand why , I would expect to have to use

imageMapper->SetColorWindow(255);
imageMapper->SetColorLevel(128);

But at least it works.


There was a bug in ImageToCooccurrenceListAdaptor

Basically itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator
is returning the same pixel for some different regions.

This seems to be described at
http://www.itk.org/pipermail/insight-users/2004-April/007949.html.

Sorry I did not know how to fix this bug.
I thought I should people looking at ImageToCooccurrenceListAdaptor
know.

Thanks



On Wed, 2004-05-19 at 15:26 -0400, Luis Ibanez wrote:

> Hi Glenn,
> 
> Loading your image
> 
> http://homepage.ntlworld.com/glenn.pierce/co-occur.png
> 
> Into the image viewer
> 
>       InsightApplications/ImageViewer
> 
> and by setting it to display logaritmic values,
> (hit the "L" key several times)( or "h" for help)
> 
> It shows that the values are actually spread around
> the bright spots. It is still pretty focused, but
> the fact is that it is not totally in the diagonal.
> 
> That may give you a hint on what's going on with
> your program....
> 
> 
>    Regards,
> 
> 
>       Luis
> 
> 
> -------------------------
> 
> Glenn Pierce wrote:
> 
> > Sorry to bother you again again. Last time hopefully
> > 
> > I have written a test program to display my co-occurrence values.
> > I have attached the program.
> > 
> > However, the values only appear on the forward diagonal as in
> > 
> > http://homepage.ntlworld.com/glenn.pierce/co-occur.png
> > 
> > They should appear throughout the image as in the
> > 
> > http://homepage.ntlworld.com/glenn.pierce/result.png
> > 
> > I cant think what the problem is.
> > 
> > When I'm done maybe I we can add this to the Examples under statistics.
> > 
> > Thanks alot
> > 
> > 
> > On Tue, 2004-05-18 at 11:17 -0400, Luis Ibanez wrote:
> > 
> >>Hi Glenn,
> >>
> >>You can visualize the 2D histogram by first copying
> >>its values in an itk::Image.
> >>
> >>For this you can write a while() loop and use the
> >>method
> >>
> >>       histogram->GetFrequency( index );
> >>
> >>Then you convert this ITK image into a VTK image
> >>using the filter adaptors in
> >>
> >>    InsightApplications/Auxiliary/vtk
> >>
> >>and plug this vtkImageData into a vtkImageViewer.
> >>
> >>
> >>---
> >>
> >>We didnt' change the actual computation of your
> >>List of measurement vectors.  More on this in a
> >>following email...
> >>
> >>
> >>  Regards,
> >>
> >>
> >>    Luis
> >>
> >>
> >>
> >>-------------------
> >>Glenn Pierce wrote:
> >>
> >>> On Sun, 2004-05-16 at 15:11 -0400, Luis Ibanez wrote:
> >>> 
> >>>>Hi Glenn,
> >>>>
> >>>>Thanks for contributing your code to ITK.
> >>>>
> >>>>The class has been added under
> >>>>
> >>>>     Insight/Code/Numerics/Statistics.
> >>>>
> >>>>
> >>> 
> >>> Thanks :)
> >>> 
> >>>>
> >>>>Your VTK question wasn't quite clear.
> >>>>
> >>>>Do you want to take a VTK image and get a cooccurrence
> >>>>matrix out of it using ITK ?
> >>>>
> >>>>or, do you want to use VTK for visualizing the
> >>>>cooccurrence matrix that you computed with ITK ?
> >>>>
> >>> 
> >>> I wanted to visualise the cooccurrence matrix with vtk as a grey scale 
> >>> image.
> >>> So I would be visualising  the frequency for each "pair of intensity 
> >>> values". 
> >>> So pairs that have a greater frequency appear as higher intensities in a 
> >>> grey level image.
> >>> 
> >>> In my code I was storing each pair in it's own MeasurementVector. 
> >>> However I should have
> >>> been increasing the frequency for pairs that are the same. Was this 
> >>> changed ?
> >>> 
> >>> 
> >>> Thanks for the help.
> >>> 
> >>> Much appreciated
> >>> 
> >>> 
> >>> Glenn
> >>> 
> >>
> >>
> >>
> 
> 
> 

--=-n2AKiUZvoYtHgxNNkoWo
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.1.12">
</HEAD>
<BODY>
Hi<BR>
<BR>
I have a nice image displaying now.<BR>
<BR>
I am scaling to&nbsp; 255 intensity values with shift-&gt;SetOutputScalarTypeToUnsignedChar();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
I get&nbsp; nice image with<BR>
<BR>
&nbsp; imageMapper-&gt;SetColorWindow(8);<BR>
&nbsp; imageMapper-&gt;SetColorLevel(4);<BR>
<BR>
I must confess I don't understand why , I would expect to have to use<BR>
<BR>
imageMapper-&gt;SetColorWindow(255);<BR>
imageMapper-&gt;SetColorLevel(128);<BR>
<BR>
But at least it works.<BR>
<BR>
<BR>
There was a bug in ImageToCooccurrenceListAdaptor<BR>
<BR>
Basically itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<BR>
is returning the same pixel for some different regions.<BR>
<BR>
This seems to be described at http://www.itk.org/pipermail/insight-users/2004-April/007949.html<FONT COLOR="#000000">.</FONT><BR>
<BR>
Sorry I did not know how to fix this bug.<BR>
I thought I should people looking at ImageToCooccurrenceListAdaptor know.<BR>
<BR>
Thanks<BR>
<BR>
<BR>
<BR>
On Wed, 2004-05-19 at 15:26 -0400, Luis Ibanez wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hi Glenn,</FONT>

<FONT COLOR="#000000">Loading your image</FONT>

<A HREF="http://homepage.ntlworld.com/glenn.pierce/co-occur.png"><FONT COLOR="#000000">http://homepage.ntlworld.com/glenn.pierce/co-occur.png</FONT></A>

<FONT COLOR="#000000">Into the image viewer</FONT>

<FONT COLOR="#000000">      InsightApplications/ImageViewer</FONT>

<FONT COLOR="#000000">and by setting it to display logaritmic values,</FONT>
<FONT COLOR="#000000">(hit the &quot;L&quot; key several times)( or &quot;h&quot; for help)</FONT>

<FONT COLOR="#000000">It shows that the values are actually spread around</FONT>
<FONT COLOR="#000000">the bright spots. It is still pretty focused, but</FONT>
<FONT COLOR="#000000">the fact is that it is not totally in the diagonal.</FONT>

<FONT COLOR="#000000">That may give you a hint on what's going on with</FONT>
<FONT COLOR="#000000">your program....</FONT>


<FONT COLOR="#000000">   Regards,</FONT>


<FONT COLOR="#000000">      Luis</FONT>


<FONT COLOR="#000000">-------------------------</FONT>

<FONT COLOR="#000000">Glenn Pierce wrote:</FONT>

<FONT COLOR="#000000">&gt; Sorry to bother you again again. Last time hopefully</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; I have written a test program to display my co-occurrence values.</FONT>
<FONT COLOR="#000000">&gt; I have attached the program.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; However, the values only appear on the forward diagonal as in</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; http://homepage.ntlworld.com/glenn.pierce/co-occur.png</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; They should appear throughout the image as in the</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; http://homepage.ntlworld.com/glenn.pierce/result.png</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; I cant think what the problem is.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; When I'm done maybe I we can add this to the Examples under statistics.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Thanks alot</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; On Tue, 2004-05-18 at 11:17 -0400, Luis Ibanez wrote:</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;Hi Glenn,</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;You can visualize the 2D histogram by first copying</FONT>
<FONT COLOR="#000000">&gt;&gt;its values in an itk::Image.</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;For this you can write a while() loop and use the</FONT>
<FONT COLOR="#000000">&gt;&gt;method</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;       histogram-&gt;GetFrequency( index );</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;Then you convert this ITK image into a VTK image</FONT>
<FONT COLOR="#000000">&gt;&gt;using the filter adaptors in</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;    InsightApplications/Auxiliary/vtk</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;and plug this vtkImageData into a vtkImageViewer.</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;---</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;We didnt' change the actual computation of your</FONT>
<FONT COLOR="#000000">&gt;&gt;List of measurement vectors.  More on this in a</FONT>
<FONT COLOR="#000000">&gt;&gt;following email...</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;  Regards,</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;    Luis</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;-------------------</FONT>
<FONT COLOR="#000000">&gt;&gt;Glenn Pierce wrote:</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; On Sun, 2004-05-16 at 15:11 -0400, Luis Ibanez wrote:</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;Hi Glenn,</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;Thanks for contributing your code to ITK.</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;The class has been added under</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;     Insight/Code/Numerics/Statistics.</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; Thanks :)</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;Your VTK question wasn't quite clear.</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;Do you want to take a VTK image and get a cooccurrence</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;matrix out of it using ITK ?</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;or, do you want to use VTK for visualizing the</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;cooccurrence matrix that you computed with ITK ?</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; I wanted to visualise the cooccurrence matrix with vtk as a grey scale </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; image.</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; So I would be visualising  the frequency for each &quot;pair of intensity </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; values&quot;. </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; So pairs that have a greater frequency appear as higher intensities in a </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; grey level image.</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; In my code I was storing each pair in it's own MeasurementVector. </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; However I should have</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; been increasing the frequency for pairs that are the same. Was this </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; changed ?</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; Thanks for the help.</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; Much appreciated</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; Glenn</FONT>
<FONT COLOR="#000000">&gt;&gt;&gt; </FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>



</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-n2AKiUZvoYtHgxNNkoWo--




More information about the Insight-users mailing list