[Insight-users] [ITK Community] 3d SEGMENTATION OF .OBJ FILE

Jon Haitz Legarreta jhlegarreta at vicomtech.org
Tue Nov 19 03:53:45 EST 2013


Hi,
you should replace the vtkImageNoiseSource for a VTK file type reader. The
following [1] example ilustrates how to proceed.

In the example Matt pointed, the VTK image source is vtkImageNoiseSource,
which creates an image filled with noise.

So you would connect the output of your reader to the connector:

std::string inputFilename = argv[1];
 // Get all data from the file
vtkSmartPointer<vtkGenericDataObjectReader> reader =
      vtkSmartPointer<vtkGenericDataObjectReader>::New();
reader->SetFileName(inputFilename.c_str());

connector->SetInput(reader->GetOutput());


HTH,
JON HAITZ


[1] www.vtk.org/Wiki/VTK/Examples/Cxx/IO/GenericDataObjectReader




On 19 November 2013 08:48, azmagillian
<xrysafenia.malliastolidou at gmail.com>wrote:

> Matt thank you so much! I think that's what i need but for 3 dimensions
>
> so below at the code i should change Image<double,2> to Image<double,3>?
> and where should i put my file .vtk input ??
>
>
> #include "itkVTKImageToImageFilter.h"
> 20
> 21 #include "vtkImageNoiseSource.h"
> 22 #include "vtkSmartPointer.h"
> 23
> 24 int itkVTKImageToImageFilterTest(int, char*[])
> 25 {
> 26   typedef itk::Image<double, 2>                 ImageType;
> 27   typedef vtkSmartPointer<vtkImageNoiseSource>  VTKNoiseType;
> 28   typedef itk::VTKImageToImageFilter<ImageType> ConnectorType;
> 29
> 30   VTKNoiseType noise_source = VTKNoiseType::New();
> 31   noise_source->SetWholeExtent(0,20,0,20,0,0);
> 32   noise_source->SetMinimum(0.0);
> 33   noise_source->SetMaximum(1.0);
> 34   noise_source->Update();
> 35
> 36   ConnectorType::Pointer connector = ConnectorType::New();
> 37   connector->SetInput(noise_source->GetOutput());
> 38   connector->Update();
> 39
> 40   connector->GetOutput()->Print(std::cout);
> 41   connector->GetImporter()->Print(std::cout);
> 42   connector->GetExporter()->Print(std::cout);
> 43
> 44   connector->Print(std::cout);
> 45
> 46   return EXIT_SUCCESS;
> 47 }
>
>
> 2013/11/18 Matt McCormick-2 [via ITK Insight Users] <
> ml-node+s2283740n7584406h17 at n2.nabble.com>
>
> > Hi,
> >
> > Code to convert a VTK ImageData to an ITK Image can be found in the
> > ITKVtkGlue module [1].
> >
> > Hope this helps,
> > Matt
> >
> > [1]
> >
> http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Bridge/VtkGlue/test/itkVTKImageToImageFilterTest.cxx;h=b22c9e8685cf26290249554d58232d3d14b24a97;hb=HEAD
> >
> > On Mon, Nov 18, 2013 at 5:14 AM, azmagillian
> > <[hidden email] <http://user/SendEmail.jtp?type=node&node=7584406&i=0>>
> > wrote:
> >
> > > Jon you said you made a filter to  "transform your VTK data object to
> an
> > > ITK image so that you can use ITK's segmentation filter."
> > >
> > > Where can i find it?
> > >
> > >  Thanks!!!
> > >
> > >
> > > 2013/11/15 Jon Haitz Legarreta Gorroño [via ITK Insight Users] <
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=7584406&i=1>>
> > >
> > >> You should either use the filter Hans mentioned or the one I did to
> > >> transform your VTK data object to an ITK image so that you can use
> > ITK's
> > >> segmentation filter.
> > >>
> > >> JON HAITZ
> > >>
> > >>
> > >>
> > >> On 15 November 2013 10:19, azmagillian <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=7584387&i=0>
> > >> > wrote:
> > >>
> > >>> Thank you all again !
> > >>>
> > >>> As i figured the first step would be to apply the Conncted Threshold
> > Image
> > >>> Filter to 3d input
> > >>>
> > >>> what changes should i make to the code?
> > >>> can i use as an input .vtk file (i converted .obj file to .vtk ) ?
> > >>>
> > >>>
> > >>> 2013/11/14 Jon Haitz Legarreta Gorroño [via ITK Insight Users] <
> > >>> [hidden email] <http://user/SendEmail.jtp?type=node&node=7584387&i=1
> >>
> >
> > >>>
> > >>>
> > >>> > Hi there,
> > >>> > you can find ITK's region growing segmentation filters here:
> > >>> >
> > http://www.itk.org/Doxygen/html/group__RegionGrowingSegmentation.html
> > >>> >
> > >>> > You will find some guidelines to use them in the ITK SW guide:
> > >>> > http://www.itk.org/ItkSoftwareGuide.pdf (not up-to-date, but there
> > is
> > >>> an
> > >>> > ongoing effort to make it again).
> > >>> >
> > >>> > HTH,
> > >>> > JON HAITZ
> > >>> >
> > >>> >
> > >>> > On 14 November 2013 15:09, azmagillian <[hidden email]<
> > >>> http://user/SendEmail.jtp?type=node&node=7584364&i=0>
> > >>>
> > >>> > > wrote:
> > >>> >
> > >>> >> Hans thanks for replying!
> > >>> >>
> > >>> >> right now i have successfully read and display my .obj with vtk
> > >>> >>
> > >>> >> for next step what should i do to use on this an itk filter ?
> > >>> >>
> > >>> >> also is there code for seeded 3D region growing segmentation ?
> > >>> >>
> > >>> >> i didn't get how to use this code
> > >>> >> http://insight-journal.org/browse/publication/178
> > >>> >>
> > >>> >>
> > >>> >> 2013/11/14 Johnson, Hans J [via ITK Insight Users] <
> > >>> >> [hidden email] <
> > http://user/SendEmail.jtp?type=node&node=7584364&i=1>>
> > >>>
> > >>> >>
> > >>> >>
> > >>> >> > There is some code that can allow conversion.  It is not fully
> > >>> >> documented,
> > >>> >> > but last time I tried, it worked well.
> > >>> >> >
> > >>> >> > http://insight-journal.org/browse/publication/178
> > >>> >> >
> > >>> >> >
> > >>> >> > Hans
> > >>> >> >
> > >>> >> >
> > >>> >> >
> > >>> >> > On 11/14/13, 6:06 AM, "azmagillian" <[hidden email]<
> > >>> >> http://user/SendEmail.jtp?type=node&node=7584358&i=0>>
> > >>> >>
> > >>> >> >
> > >>> >> > wrote:
> > >>> >> >
> > >>> >> > >Dear, ITK users , thanks in advance for your help
> > >>> >> > >
> > >>> >> > >I want to perform 3d segmentation of a .obj file
> > >>> >> > >my thought was to use connectedthreshold but there is not an
> > example
> > >>> >> for
> > >>> >> > >3d
> > >>> >> > >then i tried to use confidenceconnected threshold but i can't
> > give
> > >>> a.
> > >>> >> obj
> > >>> >> > >as
> > >>> >> > >input
> > >>> >> > >
> > >>> >> > >any ideas ?
> > >>> >> > >is there a way to convert .obj to a format suitable for itk
> > filters?
> > >>> >> > >
> > >>> >> > >
> > >>> >> > >
> > >>> >> > >--
> > >>> >> > >View this message in context:
> > >>> >> > >
> > >>> >> >
> > >>> >>
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE
> > >>> >> > >-tp7584357.html
> > >>> >> > >Sent from the ITK Insight Users mailing list archive at
> > Nabble.com.
> > >>> >> > >_____________________________________
> > >>> >> > >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://www.itk.org/mailman/listinfo/insight-users
> > >>> >> >
> > >>> >> >
> > >>> >> >
> > >>> >> > ________________________________
> > >>> >> > Notice: This UI Health Care e-mail (including attachments) is
> > >>> covered by
> > >>> >> > the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521,
> > is
> > >>> >> > confidential and may be legally privileged.  If you are not the
> > >>> intended
> > >>> >> > recipient, you are hereby notified that any retention,
> > dissemination,
> > >>> >> > distribution, or copying of this communication is strictly
> > >>> prohibited.
> > >>> >> >  Please reply to the sender that you have received the message
> in
> > >>> error,
> > >>> >> > then delete it.  Thank you.
> > >>> >> > ________________________________
> > >>> >> > _____________________________________
> > >>> >> > 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://www.itk.org/mailman/listinfo/insight-users
> > >>> >> >
> > >>> >> >
> > >>> >> > ------------------------------
> > >>> >>
> > >>> >> >  If you reply to this email, your message will be added to the
> > >>> >> discussion
> > >>> >> > below:
> > >>> >> >
> > >>> >> >
> > >>> >>
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584358.html
> > >>> >> >  To unsubscribe from 3d SEGMENTATION OF .OBJ FILE, click here<
> > >>> >> > .
> > >>> >> > NAML<
> > >>> >>
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >>> >> >
> > >>> >> >
> > >>> >>
> > >>> >>
> > >>> >>
> > >>> >>
> > >>> >> --
> > >>> >> View this message in context:
> > >>> >>
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584363.html
> > >>> >>
> > >>> >> Sent from the ITK Insight Users mailing list archive at
> Nabble.com.
> > >>> >> _____________________________________
> > >>> >> 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://www.itk.org/mailman/listinfo/insight-users
> > >>> >> _______________________________________________
> > >>> >> Community mailing list
> > >>> >> [hidden email] <
> > http://user/SendEmail.jtp?type=node&node=7584364&i=2>
> > >>> >> http://public.kitware.com/cgi-bin/mailman/listinfo/community
> > >>> >>
> > >>> >
> > >>> >
> > >>> > _____________________________________
> > >>> > 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://www.itk.org/mailman/listinfo/insight-users
> > >>> >
> > >>> >
> > >>> > ------------------------------
> > >>> >  If you reply to this email, your message will be added to the
> > >>> discussion
> > >>> > below:
> > >>> >
> > >>> >
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584364.html
> > >>>
> > >>> >  To unsubscribe from 3d SEGMENTATION OF .OBJ FILE, click here< > .
> > >>> > NAML<
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >>> >
> > >>> >
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> View this message in context:
> > >>>
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584383.html
> > >>>
> > >>> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> > >>> _____________________________________
> > >>> 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://www.itk.org/mailman/listinfo/insight-users
> > >>>
> > >>
> > >>
> > >> _____________________________________
> > >> 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://www.itk.org/mailman/listinfo/insight-users
> > >>
> > >>
> > >> ------------------------------
> > >>  If you reply to this email, your message will be added to the
> > discussion
> > >> below:
> > >>
> > >>
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584387.html
> >
> > >>  To unsubscribe from 3d SEGMENTATION OF .OBJ FILE, click here<
> >
> > >> .
> > >> NAML<
> >
> http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
> > >>
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584398.html
> >
> > > Sent from the ITK Insight Users mailing list archive at Nabble.com.
> > > _____________________________________
> > > 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://www.itk.org/mailman/listinfo/insight-users
> > > _______________________________________________
> > > Community mailing list
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=7584406&i=2>
> > > http://public.kitware.com/cgi-bin/mailman/listinfo/community
> > _____________________________________
> > 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://www.itk.org/mailman/listinfo/insight-users
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584406.html
> >  To unsubscribe from 3d SEGMENTATION OF .OBJ FILE, click here<
> http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7584357&code=eHJ5c2FmZW5pYS5tYWxsaWFzdG9saWRvdUBnbWFpbC5jb218NzU4NDM1N3wtMzkxNjk0NjEy
> >
> > .
> > NAML<
> http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://itk-insight-users.2283740.n2.nabble.com/3d-SEGMENTATION-OF-OBJ-FILE-tp7584357p7584409.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131119/e265f4cc/attachment.htm>


More information about the Insight-users mailing list