[Insight-users] Texture Features - can not find the file itkDenseFrequencyContainer2.h

Humayun Irshad humayun.irshad at gmail.com
Mon Mar 19 06:33:14 EDT 2012


Dear ITK Users,

When i run this code,

//#include <itkDenseFrequencyContainer2.h>
#include "itkHistogramToTextureFeaturesFilter.h"
#include "itkScalarImageToCooccurrenceMatrixFilter.h"

typedef itk::Neighborhood<float, Dimension> NeighborhoodType;
typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter<
FloatImageType > Image2CoOccuranceType;
typedef Image2CoOccuranceType::HistogramType HistogramType;
typedef itk::Statistics::HistogramToTextureFeaturesFilter<HistogramType>
Hist2FeaturesType;
typedef FloatImageType::OffsetType OffsetType;
typedef itk::AddImageFilter < FloatImageType > AddImageFilterType;
typedef itk::MultiplyImageFilter< FloatImageType > MultiplyImageFilterType;

void calcTextureFeatureImage (OffsetType offset, FloatImageType::Pointer
inputImage, FloatImageType::Pointer outInertia,
  FloatImageType::Pointer outCorrelation, FloatImageType::Pointer outEnergy)
{
    //allocate output images
    outInertia->CopyInformation(inputImage);
    outInertia->SetRegions(inputImage->GetLargestPossibleRegion());
    outInertia->Allocate();
    outInertia->FillBuffer(0);
    outCorrelation->CopyInformation(inputImage);
    outCorrelation->SetRegions(inputImage->GetLargestPossibleRegion());
    outCorrelation->Allocate();
    outCorrelation->FillBuffer(0);
    outEnergy->CopyInformation(inputImage);
    outEnergy->SetRegions(inputImage->GetLargestPossibleRegion());
    outEnergy->Allocate();
    outEnergy->FillBuffer(0);

    Image2CoOccuranceType::Pointer
glcmGenerator=Image2CoOccuranceType::New();
    glcmGenerator->SetOffset(offset);
    glcmGenerator->SetNumberOfBinsPerAxis(16); //reasonable number of bins
    glcmGenerator->SetPixelValueMinMax(0, 255); //for input UCHAR pixel type
    Hist2FeaturesType::Pointer featureCalc=Hist2FeaturesType::New();

    typedef itk::RegionOfInterestImageFilter<FloatImageType,FloatImageType>
roiType;
    roiType::Pointer roi=roiType::New();
    roi->SetInput(inputImage);

    FloatImageType::RegionType window;
    FloatImageType::RegionType::SizeType size;
    size.Fill(3); //window size=3x3x3
    window.SetSize(size);
    FloatImageType::IndexType pi; //pixel index

    //slide window over the entire image
    for (unsigned x=1;
x<inputImage->GetLargestPossibleRegion().GetSize(0)-1; x++)
    {
        pi.SetElement(0,x);
        window.SetIndex(0,x-1);
        for (unsigned y=1;
y<inputImage->GetLargestPossibleRegion().GetSize(1)-1; y++)
        {
            pi.SetElement(1,y);
            window.SetIndex(1,y-1);
            for (unsigned z=1;
z<inputImage->GetLargestPossibleRegion().GetSize(2)-1; z++)
            {
                pi.SetElement(2,z);
                window.SetIndex(2,z-1);
                roi->SetRegionOfInterest(window);
                roi->Update();
                glcmGenerator->SetInput(roi->GetOutput());
                glcmGenerator->Update();
                featureCalc->SetInput( glcmGenerator->GetOutput() );
                featureCalc->Update();

                outInertia->SetPixel(pi,
featureCalc->GetFeature(Hist2FeaturesType::Inertia));
                outCorrelation->SetPixel(pi,
featureCalc->GetFeature(Hist2FeaturesType::Correlation));
                outEnergy->SetPixel(pi,
featureCalc->GetFeature(Hist2FeaturesType::Energy));
            }
        }
        std::cout<<'.';
    }
}

void main()
{
        NeighborhoodType neighborhood;
neighborhood.SetRadius(1);
unsigned int centerIndex = neighborhood.GetCenterNeighborhoodIndex();
OffsetType offset;

WriterType::Pointer writer=WriterType::New();
char buf[64];

for ( unsigned int d = 0; d < centerIndex; d++ )
{
offset = neighborhood.GetOffset(d);
InternalImageType::Pointer inertia=InternalImageType::New();
InternalImageType::Pointer correlation=InternalImageType::New();
InternalImageType::Pointer energy=InternalImageType::New();
calcTextureFeatureImage(offset, image, inertia, correlation, energy);
writer->SetInput(inertia);
snprintf(buf, 100, "Inertia%u.mha", d);
writer->SetFileName(buf);
writer->Update();
writer->SetInput(correlation);
snprintf(buf, 100, "Correlation%u.mha", d);
writer->SetFileName(buf);
writer->Update();
writer->SetInput(energy);
snprintf(buf, 100, "Energy%u.mha", d);
writer->SetFileName(buf);
writer->Update();
std::cout<<'\n';
}
}

i found following error msg:

H:\ITK\ITK\Code\Review\Statistics\itkDenseFrequencyContainer2.h(58) : error
C2039: 'InstanceIdentifier' : is not a member of
'itk::MeasurementVectorTraits'
2>
 h:\itk\itk\code\numerics\statistics\itkMeasurementVectorTraits.h(44) : see
declaration of 'itk::MeasurementVectorTraits'
2>H:\ITK\ITK\Code\Review\Statistics\itkDenseFrequencyContainer2.h(58) :
error C2146: syntax error : missing ';' before identifier
'InstanceIdentifier'
2>H:\ITK\ITK\Code\Review\Statistics\itkDenseFrequencyContainer2.h(58) :
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
2>H:\ITK\ITK\Code\Review\Statistics\itkDenseFrequencyContainer2.h(58) :
error C2602:
'itk::Statistics::DenseFrequencyContainer2::InstanceIdentifier' is not a
member of a base class of 'itk::Statistics::DenseFrequencyContainer2'
2>
 H:\ITK\ITK\Code\Review\Statistics\itkDenseFrequencyContainer2.h(58) : see
declaration of
'itk::Statistics::DenseFrequencyContainer2::InstanceIdentifier'
2>
 H:\ITK\ITK\Code\Review\Statistics\itkDenseFrequencyContainer2.h(42) : see
declaration of 'itk::Statistics::DenseFrequencyContainer2'



-- 
-- 
Best Regards,

*HUMAYUN IRSHAD*
*
PhD student, University of Joseph Fourier, Grenoble, France
**
Research Engineer,
**
IPAL – Image & Pervasive Access Lab, Singapore
**
UMI CNRS (I2R/A*STAR, NUS, UJF, UPMC, IT)

Institute for Infocomm Research (I2R)
1 Fusionopolis Way
#10-19 Connexis South Tower
Singapore 138632
Tel:+65-65162864
Cell: +65-83851671

*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120319/0f5cdbef/attachment.htm>


More information about the Insight-users mailing list