Thanks Luca for your help. As you thought osirix used ITK 4.1 ant VMTK used
ITK 4.3. I thought it would be ok since osirix is using static lib while
VMTK uses dynamic lib. but I think VMTK was using the wrong classes. I had
to rename ITK name space so that VMTK use a ITK4.3 classes.

Again thanks for your help.

Ahmed A. Harouni


On Fri, Feb 8, 2013 at 12:26 PM, Luca Antiga <luca.ant...@orobix.com> wrote:

> Hi Ahmed,
>  the issue with OsiriX is very likely that vmtk is probably built against
> one version of VTK/ITK,
> while OsiriX incorporates a different version. If have to make sure OsiriX
> and vmtk link
> to the same VTK and ITK libraries.
> An alternative would be to write vmtk code as an external executable that
> you can then
> invoke as an external process from within your OsiriX plugin. You'll need
> to write the
> images to disk to pass them from OsiriX to vmtk and back, but at least you
> won't have
> the linking issue.
> Hope this helps.
>
> Luca
>
>
> On Feb 6, 2013, at 7:01 PM, Ahmed Harouni wrote:
>
>
> Dear Luca
>>
>> Thanks for your efforts and making VMTK available. I downloaded it and
>> used it from python on some of the MRI data we have and the results are
>> great. Now I want to call it directly for some Osirix plugins that I
>> wrote previously. I downloaded VMTK Source and complied it on Mac OSX Lion
>> 10.7.5. I linked it with my 64bit plugin written for Osirix 5.5.2.
>> I am getting errors of bad memory access when trying to use
>> vtkvmtkVesselnessMeasureImageFilter using
>>
>>     vtkvmtkVesselnessMeasureImageFilter *myvessel=
>> vtkvmtkVesselnessMeasureImageFilter::New()
>>
>> I and a newbie to VMTK but I think I need to initialize the filter with
>> my image pixel type and size as used in ITK (see below). Could you please
>> point me to some examples or the right classes to use as the help found
>> online is limited to information found in the header files.
>>
>> Thanks for your help
>>
>> Ahmed A. Harouni
>> long size = sizeof(float) * imageWidth * imageHeight * imageAmount;
>> const     unsigned int        Dimension       = 3;
>> typedef   float               InputPixelType;
>> typedef   float               OutputPixelType;
>> typedef   itk::Image< InputPixelType, Dimension >   InputImageType;
>> typedef   itk::Image< OutputPixelType, Dimension >  OutputImageType;
>> typedef   itk::HessianRecursiveGaussianImageFilter<InputImageType >
>>  HessianFilterType;
>> typedef   itk::Hessian3DToVesselnessMeasureImageFilter<OutputPixelType >
>> VesselnessMeasureFilterType;
>> typedef itk::ImportImageFilter< InputPixelType, Dimension >
>> ImportFilterType;
>> ImportFilterType::Pointer importFilter;
>> importFilter = ImportFilterType::New();
>> ImportFilterType::SizeType itksize;
>> itksize[0] = imageWidth; // size along X
>> itksize[1] = imageHeight; // size along Y
>> itksize[2] = imageAmount;// size along Z
>> ImportFilterType::IndexType start;
>> start.Fill( 0 );
>> ImportFilterType::RegionType region;
>> region.SetIndex( start );
>> region.SetSize( itksize );
>> importFilter->SetRegion( region );
>> double origin[ 3 ];
>> origin[0] = 0; // X coordinate
>> origin[1] = 0; // Y coordinate
>> origin[2] = 0; // Z coordinate
>> importFilter->SetOrigin( origin );
>> double spacing[ 3 ];
>> spacing[0] = imgspacing[0]; // along X direction
>> spacing[1] = imgspacing[1]; // along Y direction
>> spacing[2] = imgspacing[2]; // along Z direction
>> importFilter->SetSpacing( spacing );
>> const bool importImageFilterWillOwnTheBuffer = false;
>> importFilter->SetImportPointer( inData, itksize[0] * itksize[1] *
>> itksize[2], importImageFilterWillOwnTheBuffer);
>> NSLog(@"ITK Image allocated");
>> HessianFilterType::Pointer hessianFilter = HessianFilterType::New();
>> VesselnessMeasureFilterType::Pointer vesselnessFilter =
>> VesselnessMeasureFilterType::New();
>> hessianFilter->SetNormalizeAcrossScale(true);
>> hessianFilter->SetInput( importFilter->GetOutput() );
>> vesselnessFilter->SetInput( hessianFilter->GetOutput() );
>> vesselnessFilter->SetAlpha1(0.5);
>> vesselnessFilter->SetAlpha2(0.5);
>> float m_sigma;
>> size = imageWidth * imageHeight * imageAmount;//-4 to protect memory
>> overflow when using vec_max
>> for(m_sigma=startscale;m_sigma<=endscale;m_sigma+=scalestep)
>> {
>> hessianFilter->SetSigma(m_sigma);
>> try
>> {
>> vesselnessFilter->Update();
>> }
>>
>>
>>
>>
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
>
> http://p.sf.net/sfu/sophos-d2d-feb_______________________________________________
> vmtk-users mailing list
> vmtk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vmtk-users
>
>
>
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to