[Insight-users] Re: some requested changes

Luis Ibanez luis . ibanez at kitware . com
Thu, 11 Dec 2003 10:52:56 -0500


Hi Raghavendra,

The need for increasing the bound is not what
it is question, but rather the value of this
increase and the fact that the value is fixed
in the code.

I think Samson's suggestion of making this a
member variable that the user can set its the
way to go. We can still initialize this variable
to "0.001" if this value is a good default.

It is just not good in general to bury numerical
values in the code.

We could call it something like:

    m_BoundTolerance

or

    m_BoundIncrease


and provide Set/Get macros for getting access to it.

Would any of this names be ok with you ?
or would you prefere any more apropriate name ?


Thanks


   Luis


----------------------------------
Raghavendra Chandrashekara wrote:

> 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
>>  
>>
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>