[Insight-developers] RE: Statistics Refactoring : A few problems

Miller, James V (Research) millerjv at crd.ge.com
Thu Jul 21 16:32:30 EDT 2005


Can you change how the trait is defined

template<VectorType>
class MeasurementVectorTraits
{
public:
   unsigned long GetLength() {};
}

and the specialize the trait for each type of vector?  When templated over
a vnl_vector() it would call size()?

Jim

-----Original Message-----
From: Karthik Krishnan [mailto:Karthik.Krishnan at kitware.com]
Sent: Thursday, July 21, 2005 3:52 PM
To: Luis Ibanez
Cc: Miller, James V (Research); Insight Developers List
Subject: Statistics Refactoring : A few problems


Hi

I've gotten the Statistics framework to work with variable length 
measurement vectors with complete compatibility with existing programs. 
Now I realize that that isn't be true cause it won't work on Vs6/7.0 
cause it relies on defining traits to infer the length of the 
measurement vector based on the type, and specializing classes where the 
algorithm is different for variable length vectors and fixed length 
vectors is very different like the recently committed Histogram class.

Clearly creating complete specializations is an overkill, paricularly in 
Lauren's case where she may have arbitrary lengths. I need something like:

template<class TValueType, unsigned int TLength>
class MeasurementVectorTraits<FixedArray<TValueType, TLength > >
{
public:
  itkStaticConstMacro( MeasurementVectorLength, unsigned int, TLength );
 .......
}

Any suggestions ? I am pretty much against a wall here. [I could avoid 
using traits and break a lot of compatibility.]

Thanks
karthik



Karthik Krishnan wrote:

>
> Raghu Venkatram wrote:
>
>> Hi Karthik,
>>
>> Yes I noticed that with the new DistanceMetric. But right now, we are 
>> planning
>> to check in the BackPropagation related code during the first week of 
>> August.
>> When do you plan to incorporate the sandbox enhancements into the 
>> Statistics
>> package?
>
>
> I don't know. That would be a question for the Tzars of the Insight 
> Consortium.
>
> I don't see why it can't introduce it right away. It doesn't break any 
> API as is evident from the fact that I didn't have to change a single 
> test or Example to have them running.
>
> I will update the wiki as I make changes.
> Maybe this will be brought up this coming Tcon.
>
>>
>>
>> Thanks
>> Warm regards
>> Raghu
>>
>>
>> Quoting Karthik Krishnan <Karthik.Krishnan at kitware.com>
>>
>>> Hello Raghu,
>>>
>>> Are you using an SVN checkout of the Statistics classes from
>>> NAMICSandBox/RefactoringITKStatisticsClasses/
>>>
>>> You should be able to use the Distance metrics etc absolutely fine 
>>> with itk::Array (or for that matter any other container in 
>>> itkMeasuremetVectorTraits.h)
>>>
>>> I still have some API issues to resolve with the Histogram classes, 
>>> but most of it is ironed out. Templating your code over the 
>>> measurement vector is fine. However make sure you use 
>>> MeasurementVectorTraits to work with the measurement vector.
>>> For an example, take a look at the GaussianDensityFunction and the 
>>> DensityFunction in the NAMIC repository
>>>
>>> You will find a detailed description on the wiki.
>>>
>>> http://www.itk.org/Wiki/Proposals:Statistics_Framework_Runtime_Vector_Size 
>>>
>>>
>>>
>>> The current SVN checkout builds fine with ITK and the tests pass. 
>>> There may still be bugs.
>>>
>>> Thanks
>>> Regards
>>> Karthik
>>>
>>> Raghu Venkatram wrote:
>>>
>>>> Hi Everybody,
>>>>
>>>> With regard to DistanceMetric:
>>>>
>>>> The NeuralNetwork TransferFunctionBase class derives from 
>>>> FunctionBase and
>>>> templated over Input/Output ScalarType.
>>>> The GaussianRadialBasisFunction derives from TransferFunctionBase, 
>>>> trying to
>>>> use the EulideanDistance in here is not possible as DistanceMetric is
>>>> templated over FixedArray.
>>>> At this point, I have moved things around, so that the 
>>>> EuclideanDistance is
>>>> applied in the RBFLayer, LayerBase is templated over the input and 
>>>> output
>>>> MeasurementVectorTypes, which s itk::Vector. It might just be that 
>>>> my initial
>>>> design was flawed :).
>>>> Each layer has a transferfunction plugged in.
>>>>
>>>> Looking at  the new Statistics classes, if anything I would have to 
>>>> change
>>>> things around to take advantage of the new features, but I dont 
>>>> think it will
>>>> break the existing NeuralNetwork classes.
>>>>
>>>> Warm regards,
>>>> Raghu
>>>>
>>>>
>>>> Quoting "Stephen R. Aylward" <aylward at unc.edu>:
>>>>
>>>>> Everyone...meet Raghu.   Raghu...meet everyone. :)
>>>>>
>>>>> Raghu has also run into difficulty using the statistics framework 
>>>>> to have measurement vectors whos lengths (lenghts) are set at 
>>>>> run-time. This is needed for the neural networks library that he 
>>>>> is adding to ITK.
>>>>>
>>>>> Raghu, Luis and Karthik and Jim have created a version of the 
>>>>> statistics library that removes the requirement that the 
>>>>> measurement vector length be set at compile time (e.g., that 
>>>>> length in itkSample is now stored as an ivar instead of as a value 
>>>>> determined from the measurement vector template argument).
>>>>>
>>>>> Raghu - maybe you can checkout their version of the library (as 
>>>>> detailed below) and see if it is compatible with your solution.  
>>>>> Or perhaps you can offer an alternative solution.   Also, I tried 
>>>>> to explain the difficulties you were having with the distance 
>>>>> functions, but I didn't explain it very well.  Perhaps you can 
>>>>> clarify to the group.
>>>>>
>>>>> Thanks!
>>>>> Stephen
>>>>>
>>>>> Luis Ibanez wrote:
>>>>>
>>>>>>
>>>>>> Hi Stephen,
>>>>>>
>>>>>> Following on the discusion of the tcon on refactoring the
>>>>>> ITK Statistics Framework, here is the link to the NAMIC
>>>>>> Sandbox where Karthik has been reworking the Statistics
>>>>>> library:
>>>>>>
>>>>>> <http://www.na-mic.org/Wiki/index.php/Engineering:SandBox>
>>>>>>
>>>>>>
>>>>>> Subversion allows direct HTML access to the repository too:
>>>>>>
>>>>>>      http://www.na-mic.org:8000/svn/NAMICSandBox/
>>>>>>
>>>>>>
>>>>>> The directory of interest is:
>>>>>>
>>>>>> http://www.na-mic.org:8000/svn/NAMICSandBox/RefactoringITKStatisticsClasses/ 
>>>>>> Clients for Subversion (CVS) are available in standard
>>>>>> Linux distrbutions and Cygwin.  Windows versions can be
>>>>>> found at:
>>>>>>
>>>>>>
>>>>>>         http://subversion.tigris.org/
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>>
>>>>>>
>>>>>>
>>>>>>    Luis
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Insight-developers mailing list
>>> Insight-developers at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>
>>
>>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list