[ITK] [ITK-users] Simplex Mesh Deformable Model doesn't change

Dženan Zukić dzenanz at gmail.com
Thu Nov 2 11:19:17 EDT 2017


Hi Breno,

can you provide a link via some service which does not require installation
of some adware to download the file? I think that most could storage
providers have a free version (e.g. Dropbox or Google Drive).

Also, we are trying to switch to Discourse <https://discourse.itk.org/>,
can you re-post the message with updated link there?

Regards,
Dženan

On Wed, Nov 1, 2017 at 7:42 PM, bsouza <brufsc at hotmail.com> wrote:

> Dear itk-developers,
>
> I'm trying to use the itkDeformableSimplexMesh3D filter to make a local
> adjustment of a simplex mesh. The mesh that I want to deform using this
> filter is already initialized close to the target structure in the image.
> However, after playing with all parameter values of the filter, it seems
> that there is not significant differences between the input and output
> meshes.
>
> I'm reading the mesh from a file (stl or vtk extension) and I want to
> deform
> it using a brain MRI (nifiti format) image as a reference. After the filter
> application, the result seems to not approximate the mesh to the local
> structure in the image (only occurs a small smoothness of the model). I've
> tried to change the parameters (alpha, beta, gamma, rigidity, number of
> iterations) values to check if some change would occur, but the result
> always seems the same. I would like that deformation to be able to move the
> mesh to closer to the structure in the image. My code is below. Is there
> something wrong with my code? Why it seems that the external force has no
> influence in the mesh deform result?
>
> The image and the mesh I'm using in this test is available in the link
> below
> (I don't know how much time until the link expires):
>
> http://www73.zippyshare.com/v/sqQ6cgjN/file.html
>
> Here is my code:
>
> =================================================================
> enum PARAMS {
>     PROGRAM_NAME = 0,
>     IMAGE_FILENAME,
>     INPUT_MESH_FILENAME,
>     OUTPUT_MESH_FILENAME,
>     NUM_ARGS
> };
>
>
> using namespace std;
>
> int main( int argc, char *argv[] )
> {
>
>     if( argc < NUM_ARGS )
>     {
>         std::cerr << "\n\n";
>         std::cerr << "Usage: " << argv[PROGRAM_NAME] << " imageFileName
> inputMeshFileName ouputMeshFileName";
>         std::cerr << "\n\n";
>         return 1;
>     }
>
>     itk::STLMeshIOFactory::RegisterOneFactory();
>
>   const int dimension = 3;
>
>   typedef float PixelType;
>   typedef itk::Image<PixelType, dimension> ImageType;
>
>   typedef itk::DefaultDynamicMeshTraits<PixelType, dimension>
> TriangleMeshTraits;
>   typedef itk::DefaultDynamicMeshTraits<PixelType, dimension>
> SimplexMeshTraits;
>   typedef itk::Mesh<PixelType, dimension, TriangleMeshTraits>
> TriangleMeshType;
>   typedef itk::SimplexMesh<PixelType, dimension, SimplexMeshTraits>
> SimplexMeshType;
>
>   typedef itk::TriangleMeshToSimplexMeshFilter<TriangleMeshType,
> SimplexMeshType> TriangleToSimplexFilterType;
>   typedef itk::SimplexMeshToTriangleMeshFilter<SimplexMeshType,
> TriangleMeshType> SimplexToTriangleFilterType;
>
>   typedef itk::DeformableSimplexMesh3DFilter<SimplexMeshType,
> SimplexMeshType> DeformFilterType;
>   typedef DeformFilterType::GradientImageType
> GradientType;
>
>   typedef itk::GradientAnisotropicDiffusionImageFilter <ImageType,
> ImageType> DiffusionFilterType;
>
>   typedef itk::GradientAnisotropicDiffusionImageFilter < ImageType,
> ImageType >  GradientAnisotropicImageType;
>   typedef itk::GradientMagnitudeRecursiveGaussianImageFilter < ImageType,
> ImageType >  GradientMagnitudeType;
>   typedef itk::SigmoidImageFilter< ImageType, ImageType > SigmoidImageType;
>   typedef itk::GradientRecursiveGaussianImage
> Filter<ImageType,GradientType>
> GradientFilterType;
>
>   typedef itk::ImageFileReader<ImageType>       ImageReaderType;
>   typedef itk::ImageFileWriter<ImageType>       ImageWriterType;
>   typedef itk::MeshFileReader<TriangleMeshType> MeshReaderType;
>   typedef itk::MeshFileWriter<TriangleMeshType>  MeshWriterType;
>
>
>   ImageReaderType::Pointer imageReader = ImageReaderType::New();
>   imageReader->SetFileName(argv[IMAGE_FILENAME]);
>   imageReader->Update();
>
>   MeshReaderType::Pointer meshReader = MeshReaderType::New();
>   meshReader->SetFileName(argv[INPUT_MESH_FILENAME]);
>   meshReader->Update();
>
>   std::cout << " starting to Filter Image" << std::endl;
>   GradientAnisotropicImageType::Pointer gradientanisotropicfilter =
> GradientAnisotropicImageType::New();
>   gradientanisotropicfilter->SetInput(imageReader->GetOutput());
>   gradientanisotropicfilter->SetNumberOfIterations(5);
>   gradientanisotropicfilter->SetTimeStep(0.0625);
>   gradientanisotropicfilter->SetConductanceParameter(3);
>   gradientanisotropicfilter->Update();
>   std::cout << "GradientAnisotropicDiffusion is DONE!" << std::endl;
>
>   GradientMagnitudeType::Pointer gradientmagnitudefilter =
> GradientMagnitudeType::New();
>   gradientmagnitudefilter->SetInput( gradientanisotropicfilter->
> GetOutput()
> );
>   gradientmagnitudefilter->SetSigma(1.0);
>   gradientmagnitudefilter->Update();
>   std::cout << "GradientMagnitude is DONE!" << std::endl;
>
>   SigmoidImageType::Pointer sigmoidimagefilter = SigmoidImageType::New();
>   sigmoidimagefilter->SetInput( gradientmagnitudefilter->GetOutput());
>   sigmoidimagefilter->SetOutputMinimum(0);
>   sigmoidimagefilter->SetOutputMaximum(1);
>   sigmoidimagefilter->SetAlpha(10);
>   sigmoidimagefilter->SetBeta(100);
>   sigmoidimagefilter->Update();
>   std::cout << "Sigmoid is DONE!" << std::endl;
>
>   GradientFilterType::Pointer gradientFilter = GradientFilterType::New();
>   gradientFilter->SetInput( sigmoidimagefilter->GetOutput() );
>   gradientFilter->SetSigma(1.0);
>   gradientFilter->Update();
>   std::cout << "GradientMagnitude is DONE!" << std::endl;
>
>   std::cout << "Gradient filter ok\n";
>
>   TriangleToSimplexFilterType::Pointer triangleToSimplexFilter =
> TriangleToSimplexFilterType::New();
>   triangleToSimplexFilter->SetInput(meshReader->GetOutput());
>   triangleToSimplexFilter->Update();
>
>   GradientType::Pointer gradientImage    = gradientFilter->GetOutput();
>   SimplexMeshType::Pointer simplexMesh   =
> triangleToSimplexFilter->GetOutput();
>   DeformFilterType::Pointer deformFilter = DeformFilterType::New();
>
>   const unsigned int numberOfCycles = 100;
>
>   for (unsigned int i = 0; i < numberOfCycles; i++)
>     {
>     // must disconnect the pipeline
>     simplexMesh->DisconnectPipeline();
>     deformFilter->SetInput( simplexMesh );
>     deformFilter->SetGradient( gradientImage );
>     deformFilter->SetAlpha(0.1);
>     deformFilter->SetBeta(-0.1);
>     deformFilter->SetIterations(5);
>     deformFilter->SetRigidity(1);
>     deformFilter->Update();
>     }
>   SimplexMeshType::Pointer deformResult =  deformFilter->GetOutput();
>
>
>    SimplexToTriangleFilterType::Pointer simplexToTriangleFilter =
> SimplexToTriangleFilterType::New();
>    simplexToTriangleFilter->SetInput(deformResult);
>    simplexToTriangleFilter->Update();
>    TriangleMeshType::Pointer conversionResult =
> simplexToTriangleFilter->GetOutput();
>
>   conversionResult->DisconnectPipeline();
>
>   MeshWriterType::Pointer meshWriter = MeshWriterType::New();
>   meshWriter->SetFileName(argv[OUTPUT_MESH_FILENAME]);
>   meshWriter->SetInput(conversionResult);
>   meshWriter->Update();
>
>   return EXIT_SUCCESS;
> }
>
> =================================================================
>
> I really appreciate any help you can provide me.
>
> Thank you very much,
> Breno
>
>
>
>
> --
> Sent from: http://itk-insight-users.2283740.n2.nabble.com/
> The ITK community is transitioning from this mailing list to
> discourse.itk.org. Please join us there!
> ________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20171102/89f05d4b/attachment-0001.html>
-------------- next part --------------
The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there!
________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list