[Insight-users] Format Image in ITK

Elena Molina elenam85 at gmail.com
Fri Jul 3 20:18:17 EDT 2009


Hi,
 I´m trying to apply the algorithm "connected threshold" in my image. I have
this error:

RegionGrowing.cc(75) : error C2039: 'GetOutput' : is not a member of
'Image<float,3>'
RegionGrowing.cc(76) : error C2039: 'SetInput' : is not a member of
'Image<float,3>'

My code is:



    int x = volSize[0];
    int y = volSize[1];
    int z = volSize[2];

    vector<float> res = volSize.mm;

    float dx = res[0];
    float dy = res[0];
    float dz = res[0];

    typedef itk::Image<float,3>  ImageType;
    ImageType::Pointer InputImage = ImageType::New();
    ImageType::Pointer OutputImage = ImageType::New();

    ImageType::SizeType size;
    size[0] = x;
    size[1] = y;
    size[2] = z;

    ImageType::IndexType start;
    start[0] = 0;
    start[1] = 0;
    start[2] = 0;

    ImageType::RegionType region;
    region.SetSize( size );
    region.SetIndex( start );

    InputImage->SetRegions( region);
    InputImage->Allocate();

    float spacing[3];
    spacing[0] = res[0];
    spacing[1] = res[1];
    spacing[2] = res[2];

    InputImage->SetSpacing(spacing);

    typedef itk::ImageRegionIterator<ImageType> IteratorType;
    IteratorType it(InputImage, region);

    const float *data=subdata;
    it.GoToBegin();
    while(!it.IsAtEnd())
    {
        it.Set (*data);
        ++it;
        ++data;
    }


    typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType>
FilterType;
    FilterType::Pointer filter = FilterType::New();

    filter->SetInput(InputImage->GetOutput());
    OutputImage->SetInput(filter->GetOutput());


   How can I resolve it?

Regards,
Elena


2009/7/3 Elena Molina <elenam85 at gmail.com>

> Hi,
> First of all, I´m working with DICOM images in an already programmed (C++)
> application. Now I want to introduce
> new features in this application and I´ll use ITK libraries.
> So... my problem now is how can I convert my image (actually I have my
> image in memory (3D) and I have the
> pointer to the first position of this image) in a compliant format for
> using it with ITK functions.
> I was reading in the getting started V how can I integrating ITK in my
> application and tried to do the same example but It
> didn´t work.
> How can I do it? Which parameters I need? Pointer in the first position,
> size... any more?
>
> Thankssssss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090704/9aa293ce/attachment-0001.htm>


More information about the Insight-users mailing list