<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Breno,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">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).</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Also, we are trying to switch to <a href="https://discourse.itk.org/">Discourse</a>, can you re-post the message with updated link there?</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Dženan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 1, 2017 at 7:42 PM, bsouza <span dir="ltr"><<a href="mailto:brufsc@hotmail.com" target="_blank">brufsc@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear itk-developers,<br>
<br>
I'm trying to use the itkDeformableSimplexMesh3D filter to make a local<br>
adjustment of a simplex mesh. The mesh that I want to deform using this<br>
filter is already initialized close to the target structure in the image.<br>
However, after playing with all parameter values of the filter, it seems<br>
that there is not significant differences between the input and output<br>
meshes.<br>
<br>
I'm reading the mesh from a file (stl or vtk extension) and I want to deform<br>
it using a brain MRI (nifiti format) image as a reference. After the filter<br>
application, the result seems to not approximate the mesh to the local<br>
structure in the image (only occurs a small smoothness of the model). I've<br>
tried to change the parameters (alpha, beta, gamma, rigidity, number of<br>
iterations) values to check if some change would occur, but the result<br>
always seems the same. I would like that deformation to be able to move the<br>
mesh to closer to the structure in the image. My code is below. Is there<br>
something wrong with my code? Why it seems that the external force has no<br>
influence in the mesh deform result?<br>
<br>
The image and the mesh I'm using in this test is available in the link below<br>
(I don't know how much time until the link expires):<br>
<br>
<a href="http://www73.zippyshare.com/v/sqQ6cgjN/file.html" rel="noreferrer" target="_blank">http://www73.zippyshare.com/v/<wbr>sqQ6cgjN/file.html</a><br>
<br>
Here is my code:<br>
<br>
==============================<wbr>==============================<wbr>=====<br>
enum PARAMS {<br>
    PROGRAM_NAME = 0,<br>
    IMAGE_FILENAME,<br>
    INPUT_MESH_FILENAME,<br>
    OUTPUT_MESH_FILENAME,<br>
    NUM_ARGS<br>
};<br>
<br>
<br>
using namespace std;<br>
<br>
int main( int argc, char *argv[] )<br>
{<br>
<br>
    if( argc < NUM_ARGS )<br>
    {<br>
        std::cerr << "\n\n";<br>
        std::cerr << "Usage: " << argv[PROGRAM_NAME] << " imageFileName<br>
inputMeshFileName ouputMeshFileName";<br>
        std::cerr << "\n\n";<br>
        return 1;<br>
    }<br>
<br>
    itk::STLMeshIOFactory::<wbr>RegisterOneFactory();<br>
<br>
  const int dimension = 3;<br>
<br>
  typedef float PixelType;<br>
  typedef itk::Image<PixelType, dimension> ImageType;<br>
<br>
  typedef itk::DefaultDynamicMeshTraits<<wbr>PixelType, dimension><br>
TriangleMeshTraits;<br>
  typedef itk::DefaultDynamicMeshTraits<<wbr>PixelType, dimension><br>
SimplexMeshTraits;<br>
  typedef itk::Mesh<PixelType, dimension, TriangleMeshTraits><br>
TriangleMeshType;<br>
  typedef itk::SimplexMesh<PixelType, dimension, SimplexMeshTraits><br>
SimplexMeshType;<br>
<br>
  typedef itk::<wbr>TriangleMeshToSimplexMeshFilte<wbr>r<TriangleMeshType,<br>
SimplexMeshType> TriangleToSimplexFilterType;<br>
  typedef itk::<wbr>SimplexMeshToTriangleMeshFilte<wbr>r<SimplexMeshType,<br>
TriangleMeshType> SimplexToTriangleFilterType;<br>
<br>
  typedef itk::<wbr>DeformableSimplexMesh3DFilter<<wbr>SimplexMeshType,<br>
SimplexMeshType> DeformFilterType;<br>
  typedef DeformFilterType::<wbr>GradientImageType<br>
GradientType;<br>
<br>
  typedef itk::<wbr>GradientAnisotropicDiffusionIm<wbr>ageFilter <ImageType,<br>
ImageType> DiffusionFilterType;<br>
<br>
  typedef itk::<wbr>GradientAnisotropicDiffusionIm<wbr>ageFilter < ImageType,<br>
ImageType >  GradientAnisotropicImageType;<br>
  typedef itk::<wbr>GradientMagnitudeRecursiveGaus<wbr>sianImageFilter < ImageType,<br>
ImageType >  GradientMagnitudeType;<br>
  typedef itk::SigmoidImageFilter< ImageType, ImageType > SigmoidImageType;<br>
  typedef itk::<wbr>GradientRecursiveGaussianImage<wbr>Filter<ImageType,GradientType><br>
GradientFilterType;<br>
<br>
  typedef itk::ImageFileReader<<wbr>ImageType>       ImageReaderType;<br>
  typedef itk::ImageFileWriter<<wbr>ImageType>       ImageWriterType;<br>
  typedef itk::MeshFileReader<<wbr>TriangleMeshType> MeshReaderType;<br>
  typedef itk::MeshFileWriter<<wbr>TriangleMeshType>  MeshWriterType;<br>
<br>
<br>
  ImageReaderType::Pointer imageReader = ImageReaderType::New();<br>
  imageReader->SetFileName(argv[<wbr>IMAGE_FILENAME]);<br>
  imageReader->Update();<br>
<br>
  MeshReaderType::Pointer meshReader = MeshReaderType::New();<br>
  meshReader->SetFileName(argv[<wbr>INPUT_MESH_FILENAME]);<br>
  meshReader->Update();<br>
<br>
  std::cout << " starting to Filter Image" << std::endl;<br>
  GradientAnisotropicImageType::<wbr>Pointer gradientanisotropicfilter =<br>
GradientAnisotropicImageType::<wbr>New();<br>
  gradientanisotropicfilter-><wbr>SetInput(imageReader-><wbr>GetOutput());<br>
  gradientanisotropicfilter-><wbr>SetNumberOfIterations(5);<br>
  gradientanisotropicfilter-><wbr>SetTimeStep(0.0625);<br>
  gradientanisotropicfilter-><wbr>SetConductanceParameter(3);<br>
  gradientanisotropicfilter-><wbr>Update();<br>
  std::cout << "GradientAnisotropicDiffusion is DONE!" << std::endl;<br>
<br>
  GradientMagnitudeType::Pointer gradientmagnitudefilter =<br>
GradientMagnitudeType::New();<br>
  gradientmagnitudefilter-><wbr>SetInput( gradientanisotropicfilter-><wbr>GetOutput()<br>
);<br>
  gradientmagnitudefilter-><wbr>SetSigma(1.0);<br>
  gradientmagnitudefilter-><wbr>Update();<br>
  std::cout << "GradientMagnitude is DONE!" << std::endl;<br>
<br>
  SigmoidImageType::Pointer sigmoidimagefilter = SigmoidImageType::New();<br>
  sigmoidimagefilter->SetInput( gradientmagnitudefilter-><wbr>GetOutput());<br>
  sigmoidimagefilter-><wbr>SetOutputMinimum(0);<br>
  sigmoidimagefilter-><wbr>SetOutputMaximum(1);<br>
  sigmoidimagefilter->SetAlpha(<wbr>10);<br>
  sigmoidimagefilter->SetBeta(<wbr>100);<br>
  sigmoidimagefilter->Update();<br>
  std::cout << "Sigmoid is DONE!" << std::endl;<br>
<br>
  GradientFilterType::Pointer gradientFilter = GradientFilterType::New();<br>
  gradientFilter->SetInput( sigmoidimagefilter->GetOutput(<wbr>) );<br>
  gradientFilter->SetSigma(1.0);<br>
  gradientFilter->Update();<br>
  std::cout << "GradientMagnitude is DONE!" << std::endl;<br>
<br>
  std::cout << "Gradient filter ok\n";<br>
<br>
  TriangleToSimplexFilterType::<wbr>Pointer triangleToSimplexFilter =<br>
TriangleToSimplexFilterType::<wbr>New();<br>
  triangleToSimplexFilter-><wbr>SetInput(meshReader-><wbr>GetOutput());<br>
  triangleToSimplexFilter-><wbr>Update();<br>
<br>
  GradientType::Pointer gradientImage    = gradientFilter->GetOutput();<br>
  SimplexMeshType::Pointer simplexMesh   =<br>
triangleToSimplexFilter-><wbr>GetOutput();<br>
  DeformFilterType::Pointer deformFilter = DeformFilterType::New();<br>
<br>
  const unsigned int numberOfCycles = 100;<br>
<br>
  for (unsigned int i = 0; i < numberOfCycles; i++)<br>
    {<br>
    // must disconnect the pipeline<br>
    simplexMesh-><wbr>DisconnectPipeline();<br>
    deformFilter->SetInput( simplexMesh );<br>
    deformFilter->SetGradient( gradientImage );<br>
    deformFilter->SetAlpha(0.1);<br>
    deformFilter->SetBeta(-0.1);<br>
    deformFilter->SetIterations(5)<wbr>;<br>
    deformFilter->SetRigidity(1);<br>
    deformFilter->Update();<br>
    }<br>
  SimplexMeshType::Pointer deformResult =  deformFilter->GetOutput();<br>
<br>
<br>
   SimplexToTriangleFilterType::<wbr>Pointer simplexToTriangleFilter =<br>
SimplexToTriangleFilterType::<wbr>New();<br>
   simplexToTriangleFilter-><wbr>SetInput(deformResult);<br>
   simplexToTriangleFilter-><wbr>Update();<br>
   TriangleMeshType::Pointer conversionResult =<br>
simplexToTriangleFilter-><wbr>GetOutput();<br>
<br>
  conversionResult-><wbr>DisconnectPipeline();<br>
<br>
  MeshWriterType::Pointer meshWriter = MeshWriterType::New();<br>
  meshWriter->SetFileName(argv[<wbr>OUTPUT_MESH_FILENAME]);<br>
  meshWriter->SetInput(<wbr>conversionResult);<br>
  meshWriter->Update();<br>
<br>
  return EXIT_SUCCESS;<br>
}<br>
<br>
==============================<wbr>==============================<wbr>=====<br>
<br>
I really appreciate any help you can provide me.<br>
<br>
Thank you very much,<br>
Breno<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://itk-insight-users.2283740.n2.nabble.com/" rel="noreferrer" target="_blank">http://itk-insight-users.<wbr>2283740.n2.nabble.com/</a><br>
The ITK community is transitioning from this mailing list to <a href="http://discourse.itk.org" rel="noreferrer" target="_blank">discourse.itk.org</a>. Please join us there!<br>
______________________________<wbr>__<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>