[Insight-users] CovarianceCalculator
Luis Ibanez
luis.ibanez at kitware.com
Wed Jun 16 15:43:12 EDT 2004
Hi Lucas,
If the vector size is not known at compliation time,
you are probably having to defined the images as:
itk::Image< std::vector< float >, Dimension >
and.. in that case you will have to write your own
ImageIO object in order to read the fileformat.
Another option for you could be to store individual
components per file. That is, instead of a file with
and image with 60 components per pixel, you could
store 60 files each one with an image of 1 component
per pixel.
You could read these images sequencially using any
of the existing fileformats, an then copy the content
fron the incoming image into the i-th component of
the
itk::Image< std::vector< float >, Dimension >
You may want to sit in a peaceful place with some
coffee and do the math for the memory footprint of
such an image, because it can easily get out of control.
Note also that you must consider upfront the type
of processing that you expect to apply to such an
image.
Are you planning to do segmentation on it ?
maybe statistical classification ?
Note that the above image type may not satisfy the
API expected by some ITK filters.
Regards,
Luis
--------------------
Lucas Lorenzo wrote:
> 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