[Insight-users] CovarianceCalculator
Lucas Lorenzo
lucas at cvrti.utah.edu
Wed Jun 16 13:58:32 EDT 2004
Hi Luis,
thanks a lot for your answer.
mmm ... my problem is that I'll have to deal with 2D images of vectors
(right now I've defined them as itk::Vector type) but the length of
these vectors might change from one file to another.
Is there any way to load such an image from a file without knowing the
vector size at compilation time ?
Thanks,
Lucas
On Jun 15, 2004, at 11:31 PM, Luis Ibanez wrote:
>
> Hi Lucas,
>
> The source of the problem is that VXL uses explicit
> instantiation of Templates as opposed to ITK that
> uses implicit instatiation.
>
> This means that in vnl you can only use types that
> have already been explicity instantiated in the
> library. If you need to use a new combination, then
> you have to add the corresponding explicit instantiation.
>
> The vnl_fixed_matrix is only instantiated for a
> certain number of template parameters.
>
> You will find them under:
>
> Insight/Utilities/vxl/core/vnl/Templates
>
> They are
>
> vnl_matrix_fixed+double.1.1-.cxx
> vnl_matrix_fixed+double.1.2-.cxx
> vnl_matrix_fixed+double.1.3-.cxx
> vnl_matrix_fixed+double.2.1-.cxx
> vnl_matrix_fixed+double.2.2-.cxx
> vnl_matrix_fixed+double.2.3-.cxx
> vnl_matrix_fixed+double.2.4-.cxx
> vnl_matrix_fixed+double.2.6-.cxx
> vnl_matrix_fixed+double.3.1-.cxx
> vnl_matrix_fixed+double.3.2-.cxx
> vnl_matrix_fixed+double.3.3-.cxx
> vnl_matrix_fixed+double.3.4-.cxx
> vnl_matrix_fixed+double.3.5-.cxx
> vnl_matrix_fixed+double.4.1-.cxx
> vnl_matrix_fixed+double.4.2-.cxx
> vnl_matrix_fixed+double.4.3-.cxx
> vnl_matrix_fixed+double.4.4-.cxx
> vnl_matrix_fixed+double.6.6-.cxx
> vnl_matrix_fixed+float.1.2-.cxx
> vnl_matrix_fixed+float.1.3-.cxx
> vnl_matrix_fixed+float.2.1-.cxx
> vnl_matrix_fixed+float.2.2-.cxx
> vnl_matrix_fixed+float.3.1-.cxx
> vnl_matrix_fixed+float.3.3-.cxx
> vnl_matrix_fixed+float.3.4-.cxx
> vnl_matrix_fixed+float.3.5-.cxx
> vnl_matrix_fixed+float.4.3-.cxx
> vnl_matrix_fixed+float.4.4-.cxx
> vnl_matrix_fixed+int.2.2-.cxx
> vnl_matrix_fixed+int.3.4-.cxx
> vnl_matrix_fixed+vnl_bignum.3.3-.cxx
> vnl_matrix_fixed+vnl_rational.3.3-.cxx
> vnl_matrix_fixed_pairwise_ops.cxx
> vnl_matrix_fixed_ref+double.3.3-.cxx
> vnl_matrix_fixed_ref+double.3.4-.cxx
> vnl_matrix_fixed_ref+float.3.3-.cxx
> vnl_matrix_fixed_ref+float.3.4-.cxx
>
>
> As you can see, there is no instantiation for a matrix
> of size 60 x 60 which is what you seems to be trying
> to instantiate.
>
> BTW, Do you realy have a problem where your
> feature vector has 60 components ?
>
>
> If you really want to have 60 x 60 for
> the matrix dimension, then you could add
> a new file for explicit instantiation of
> your matrix type. Note that you must add
> this new file to the CMakeLists.txt file
> in that directory.
>
> You may want to take a file such as:
>
> vnl_matrix_fixed+double.6.6-.cxx
>
> and copy/rename it as
>
> vnl_matrix_fixed+double.60.60-.cxx
>
> and change its internals in order to
> use 60 x 60 as template arguments for
> the matrix dimensions.
>
>
>
>
> Regards,
>
>
> Luis
>
>
>
> ---------------------
> Lucas Lorenzo wrote:
>
>> Hi all,
>> I'm having a linking problem when compiling the following code (I'm
>> including only the important parts):
>> /
>> #include "itkVector.h"
>> #include "itkListSample.h"
>> #include "itkCovarianceCalculator.h"
>> int main( int argc, char * argv[] )
>> {
>> const unsigned int vsize = 60;
>> typedef itk::Vector< float, vsize > InputPixelType;
>> typedef itk::Statistics::ListSample< InputPixelType > SampleType ;
>> SampleType::Pointer sample = SampleType::New() ;
>> // here I create the samplelist
>> typedef itk::Statistics::CovarianceCalculator< SampleType >
>> CovarianceAlgorithmType;
>> CovarianceAlgorithmType::Pointer covarianceAlgorithm =
>> CovarianceAlgorithmType::New();
>> covarianceAlgorithm->SetInputSample( sample );
>> // I've already calculated the mean:
>> covarianceAlgorithm->SetMean( meanAlgorithm->GetOutput() );
>> covarianceAlgorithm->Update();
>> return 0;
>> }
>> /
>> The error message looks as follows:
>> /lucas:Seg_Code> make
>> Building dependencies cmake.check_depends...
>> Building object file ThresholdSegPrSh.o...
>> Building executable
>> /private/var/automount/Seg_Code/ThresholdSegPrSh...
>> ld: Undefined symbols:
>> vnl_matrix_fixed<double, (unsigned)60, (unsigned)60>::div(double
>> const*, double, double*)
>> vnl_matrix_fixed<double, (unsigned)60, (unsigned)60>::fill(double)
>> vnl_matrix_fixed<double, (unsigned)60,
>> (unsigned)60>::print(std::basic_ostream<char, std::char_traits<char>
>> >&) const
>> make[1]: *** [/private/var/automount/Seg_Code/ThresholdSegPrSh] Error
>> 1
>> make: *** [default_target] Error 2
>> /
>> Could anyone please help me with this problem ?
>> Thanks,
>> Lucas Lorenzo
>> University of Utah
>> Nora Eccles Harrison CardioVascular Research and Training Institute
>> Fellows Room
>> 95 South 2000 East
>> Salt Lake City, UT 84112-5000
>> e-mail: lucas at cvrti.utah.edu
>> telephone: 801-587-9536
>> ----------------------------------------------------------------------
>> --
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
Lucas Lorenzo
University of Utah
Nora Eccles Harrison CardioVascular Research and Training Institute
Fellows Room
95 South 2000 East
Salt Lake City, UT 84112-5000
e-mail: lucas at cvrti.utah.edu
telephone: 801-587-9536
More information about the Insight-users
mailing list