[Insight-users] Gradient Vector Field and Level Set

droettger at uni-koblenz.de droettger at uni-koblenz.de
Tue Nov 25 06:57:25 EST 2008


Thank you verry much, now it works. =D

Regards,
Diana

> Hi Diana,
>   try something along these lines (see below): basically, you need a
> cast image filter to cast your image, since the pixel types are
> already compatible, you don't need to do it manually.
> Best regards
>
> Luca
>
>
> #include "itkImage.h"
> #include "itkGradientVectorFlowImageFilter.h"
> #include "itkGeodesicActiveContourLevelSetImageFilter.h"
> #include "itkCastImageFilter.h"
>
> int main (int argc, char* argv[])
> {
>    typedef itk::Image<double,3> ImageType;
>
>    typedef itk::CovariantVector<double,3>  GradientPixelType;
>    typedef itk::Image<GradientPixelType,3> GradientImageType;
>
>    typedef
> itk::GradientVectorFlowImageFilter<GradientImageType,GradientImageType>
> GVFFilterType;
>
>    typedef
> itk::GeodesicActiveContourLevelSetImageFilter<ImageType,ImageType>
> GeodesicActiveContourFilterType;
>    typedef GeodesicActiveContourFilterType::VectorImageType
> AdvectionImageType;
>
>    typedef itk::CastImageFilter<GradientImageType,AdvectionImageType>
> CastFilterType;
>
>    GVFFilterType::Pointer gvfFilter = GVFFilterType::New();
> // other code here...
>
>    CastFilterType::Pointer castFilter = CastFilterType::New();
>    castFilter->SetInput(gvfFilter->GetOutput());
>
>    GeodesicActiveContourFilterType::Pointer gacFilter =
> GeodesicActiveContourFilterType::New();
>    gacFilter->SetAdvectionImage(castFilter->GetOutput());
> // other code here...
>
>    return 1;
> }
>
>
> On Nov 24, 2008, at 12:22 PM, droettger at uni-koblenz.de wrote:
>
>> Hey Luca,
>>
>> thanks for your help.
>> I figured out, that GradientVectorFlowImageFilter works only with
>> CovariantVector, whereas
>> SetAdvectionImage works only with a FixedArray.
>> Now I have to transferr the data, or do you have another idea?
>>
>> BR,
>> Diana
>>
>>> Hey Diana,
>>>   sorry for the late reply.
>>> Yes, this is what I meant. What is the exact problem you're getting
>>> when you do the thing below?
>>> SetAdvectionImage takes a Image< FixedArray<... as pixel type, and
>>> CovariantVector is derived
>>> from FixedArray, so it should work, if I'm not missing anything.
>>> But I believe you when you say it doesn't: can you post a dump of the
>>> errors?
>>>
>>> Luca
>>>
>>>
>>> On Nov 17, 2008, at 11:13 AM, droettger at uni-koblenz.de wrote:
>>>
>>>> Hey Luca,
>>>>
>>>> thaks for your help so far. I see how the different terms work.
>>>> I've tried th SetAdvectionImage method, but I didn't succeed.
>>>>
>>>> Here are parts out of my code:
>>>>
>>>> typedef itk::CovariantVector< double, 3 >  GradientPixelType;
>>>> typedef itk::Image< GradientPixelType, 3> GradientImageType;
>>>>
>>>> typedef itk::GradientVectorFlowImageFilter<GradientImageType,
>>>> 	GradientImageType> GVFFilterType;
>>>>
>>>> GradientImageType::Pointer m_GVFField;
>>>>
>>>> m_GVFField = gradientVectorFlow->GetOutput();
>>>>
>>>> geodesicActiveContour->SetAdvectionImage(m_GVFField);
>>>>
>>>> This is what you meant, right?
>>>>
>>>> Thanks,
>>>> Diana
>>>>
>>>>> Hey Diana,
>>>>>   you should set the vector image using the SetAdvectionImage
>>>>> method.
>>>>> The template parameter for the FeatureImageType has to be a scalar
>>>>> image of the same type of your gradient (take a look at the source
>>>>> code for the filter).
>>>>> I'm in a bit of a rush now, please get back to me if you don't
>>>>> succeed and I'll give you step by step instructions.
>>>>> Regards
>>>>>
>>>>> Luca
>>>>>
>>>>>
>>>>>
>>>>> On Nov 13, 2008, at 5:31 PM, droettger at uni-koblenz.de wrote:
>>>>>
>>>>>> Hey,
>>>>>>
>>>>>> do you mean that I should declare the feature image, the input of
>>>>>> GeodesicActiveContourLevelSetImageFilter, as the output of the
>>>>>> GradientVectorFlowImageFilter?
>>>>>>
>>>>>> I defined a GradientImageType:
>>>>>> typedef itk::CovariantVector< double, 3 >  GradientPixelType;
>>>>>> typedef itk::Image< GradientPixelType, 3> GradientImageType;
>>>>>>
>>>>>> Hence, the definition of GeodesicActiveContourLevelSetImageFilter
>>>>>> is:
>>>>>>
>>>>>> typedef itk::GeodesicActiveContourLevelSetImageFilter<
>>>>>> InternalImageType,
>>>>>> 	GradientImageType > GeodesicActiveContourFilterType;
>>>>>>
>>>>>> Am I right? That doesn't work in my case.
>>>>>> How should I integrate the vector field?
>>>>>>
>>>>>> Thanks,
>>>>>> Diana
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi Diana,
>>>>>>>  you should use it as the advection field in the
>>>>>>> GeodesicActiveContourLevelSetImageFilter, rather than speed.
>>>>>>> Best regards
>>>>>>>
>>>>>>> Luca
>>>>>>>
>>>>>>> 2008/11/13, droettger at uni-koblenz.de <droettger at uni-koblenz.de>:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I want to include the itkGradientVectorFlowImageFilter into a
>>>>>>>> level set
>>>>>>>> approach, using the ShapeDetectionLevelSetImageFilter.
>>>>>>>> The gradient diffusion, resulting out of GVF should perform an
>>>>>>>> external
>>>>>>>> force, in terms of the level set speed function.
>>>>>>>>
>>>>>>>> My question is, if I can simply use the output of
>>>>>>>> itkGradientVectorFlowImageFilter as the speed image, since it
>>>>>>>> is a
>>>>>>>> vector
>>>>>>>> field, and needs a diffrent approximation than a scalar image.
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks in advance,
>>>>>>>> Diana
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Insight-users mailing list
>>>>>>>> Insight-users at itk.org
>>>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Inviato dal mio dispositivo mobile
>>>>>>>
>>>>>>> Luca Antiga, PhD
>>>>>>>  Biomedical Technologies Laboratory
>>>>>>>  Biomedical Engineering Department,
>>>>>>>  Mario Negri Institute
>>>>>>> mail: Villa Camozzi, 24020, Ranica (BG), Italy
>>>>>>> phone: +39 035 4535-381
>>>>>>> email: antiga at marionegri.it
>>>>>>> web: http://villacamozzi.marionegri.it/~luca
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Insight-users mailing list
>>>>>> Insight-users at itk.org
>>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>





More information about the Insight-users mailing list