[Insight-users] Re: some requested changes

Raghavendra Chandrashekara rc3 at doc . ic . ac . uk
Thu, 11 Dec 2003 11:05:33 +0000


Hi Samson,

Thanks for your comments and finding the bugs in the test programs!

Luis Ibanez wrote:

> 3)  The min/max Fixed/Moving variables were added as you
>     suggested.  I din't dare to remove the "evil" 0.001
>     in this pass, so please keep this as an open issue
>     we may have to pay a second visit to this file. 

The reason that the upper bound was increased by a small amount was that 
the itkHistogram class is designed not to hold a sample value equal to 
the upper bound value of the histogram. I quote the message where there 
was a discussion about this (05/13/2003) below. Since the images being 
registered will contain these upper bound samples the upper bounds held 
in the metrics are increased slightly. Maybe it would be better to 
remove the 0.001 and let the user worry about setting the upper bound 
appropriately for the images they are using? What do you think Luis?

Raghavendra

>Hi.
>
>The answer is no. It's by design. You have set the
>upper bound a little bit larger than the largest value
>you want to put into it. 
>--- Raghavendra Chandrashekara <rc3 at doc . ic . ac . uk>
>wrote:
>  
>
>>> Hi Folks,
>>> 
>>> Is it possible for the itk::Histogram class to hold
>>> a sample value which 
>>> is equal to the upper bound value? I've written a
>>> simple test program 
>>> which creates a 2D histogram and tries to increase
>>> the frequency of a 
>>> sample value at the lower and upper bounds. The
>>> lower bound sample value 
>>> frequency is increased by 1, but the upper bound is
>>> not. Please can you 
>>> tell me if this is a bug or this is the expected
>>> behaviour.
>>> 
>>> Thanks,
>>> 
>>> Raghavendra
>>    
>>
>>>> > #include "itkHistogram.h"
>>>      
>>>
>>> 
>>> int main()
>>> {
>>>   typedef itk::Statistics::Histogram<double, 2>
>>> HistogramType;
>>> 
>>>   // Initialize histogram.
>>>   HistogramType::Pointer pHistogram =
>>> HistogramType::New();
>>>   HistogramType::MeasurementVectorType lowerBound;
>>>   HistogramType::MeasurementVectorType upperBound;
>>>   HistogramType::SizeType size;
>>>   size.Fill(1024);
>>>   lowerBound.Fill(0);
>>>   upperBound.Fill(255);
>>>   pHistogram->Initialize(size, lowerBound,
>>> upperBound);
>>> 
>>>   // Add samples.
>>>   HistogramType::MeasurementVectorType vec;
>>>   vec[0] = 0;
>>>   vec[1] = 0;
>>>   pHistogram->IncreaseFrequency(vec, 1);
>>>   vec[0] = 255;
>>>   vec[1] = 255;
>>>   pHistogram->IncreaseFrequency(vec, 1);
>>> 
>>>   HistogramType::Iterator it = pHistogram->Begin();
>>>   HistogramType::Iterator end = pHistogram->End();
>>>   while (it != end) {
>>>     if (it.GetFrequency() > 0) {
>>>       std::cout << "Measurement = " <<
>>> it.GetMeasurementVector()
>>> 		<< "Frequency = " << it.GetFrequency() <<
>>> std::endl;
>>>     }
>>>     ++it;
>>>   }
>>> 
>>>   return 0;
>>> }
>>    
>>
>>>> > PROJECT(Histogram)
>>>      
>>>
>>> 
>>> INCLUDE(${CMAKE_ROOT}/Modules/FindITK.cmake)
>>> 
>>> IF (ITK_USE_FILE)
>>>   INCLUDE(${ITK_USE_FILE})
>>> ENDIF (ITK_USE_FILE)
>>> 
>>> INCLUDE_DIRECTORIES(${VIPITK_SOURCE_DIR}/Code)
>>> LINK_DIRECTORIES(${VIPITK_BINARY_DIR}/Code)
>>> LINK_LIBRARIES(${ITK_LIBRARIES})
>>> 
>>> ADD_EXECUTABLE(Histogram Histogram.cpp)
>>    
>>
>
>
>=====
>Jisung Kim
>bahrahm at yahoo . com
>106 Mason Farm Rd.
>129 Radiology Research Lab., CB# 7515
>Univ. of North Carolina at Chapel Hill
>Chapel Hill, NC 27599-7515
>
>__________________________________
>Do you Yahoo!?
>The New Yahoo! Search - Faster. Easier. Bingo.
>http://search . yahoo . com
>  
>