[Insight-users] Insight-users Digest, Vol 70, Issue 67

Andriy Fedorov fedorov at bwh.harvard.edu
Thu Feb 18 10:28:13 EST 2010


application of watershed segmentation to meningioma tumors --
InsightApplications/SegmentationEditor



On Thu, Feb 18, 2010 at 10:18,  <insight-users-request at itk.org> wrote:
> Send Insight-users mailing list submissions to
>        insight-users at itk.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://www.itk.org/mailman/listinfo/insight-users
> or, via email, send a message with subject or body 'help' to
>        insight-users-request at itk.org
>
> You can reach the person managing the list at
>        insight-users-owner at itk.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Insight-users digest..."
>
>
> Today's Topics:
>
>   1. Re: different variations of demons registration (Tom Vercauteren)
>   2. Re: Reading LSM images (Lassi Paavolainen)
>   3. Re: ITK video on youtube (Dan Mueller)
>   4. Re: ITK video on youtube (Martin Kavec)
>   5. Re: problem to convert a mesh to a Binary image (Luis Ibanez)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 18 Feb 2010 10:11:07 +0100
> From: Tom Vercauteren <tom.vercauteren at m4x.org>
> Subject: Re: [Insight-users] different variations of demons
>        registration
> To: Zoltan Seress <seress.zoltan at gmail.com>
> Cc: insight-users at itk.org, Luis Ibanez <luis.ibanez at kitware.com>
> Message-ID:
>        <28392e8b1002180111k48e1081fi22738e73933a3f4f at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hi Zoltan,
>
> Yes, there might be some differences related to border effects,
> smoothing steps, rounding issues and so on. See e.g.
> http://www.itk.org/Bug/view.php?id=7351
> http://www.itk.org/Bug/view.php?id=3973
>
> My experience would favor the use of
> FastSymmetricForcesDemonsRegistrationFilter vs
> SymmetricForcesDemonsRegistrationFilter since I tried to make it as
> stable as possible.
>
> As a side note you might want to try the command-line tools provided in either
> http://www.insight-journal.org/browse/publication/644
> or
> http://www.nitrc.org/projects/brainsdemonwarp/
>
> They both provide easy means of comparing many demons versions.
>
> Tom
>
> On Thu, Feb 18, 2010 at 09:56, Zoltan Seress <seress.zoltan at gmail.com> wrote:
>> Hi,
>> Thanks for the answers. Then is there any reason to
>> use?SymmetricForcesDemonsRegistrationFilter
>> if?FastSymmetricForcesDemonsRegistrationFilter is at hand? Could be any
>> difference between the registration results of them?
>>
>> On Thu, Feb 18, 2010 at 8:37 AM, Tom Vercauteren <tom.vercauteren at gmail.com>
>> wrote:
>>>
>>> Hi Zoltan,
>>>
>>> FastSymmetricForcesDemonsRegistrationFilter and
>>> SymmetricForcesDemonsRegistrationFilter use the same algorithm from
>>> Thirion. The only difference lies in the implementation. As
>>> illustrated by the name of the class,
>>> FastSymmetricForcesDemonsRegistrationFilter ?should just be faster...
>>>
>>> Tom
>>>
>>> On Thu, Feb 18, 2010 at 00:59, Luis Ibanez <luis.ibanez at kitware.com>
>>> wrote:
>>> > Hi Zoltan,
>>> >
>>> >
>>> > It seems that you missed the text from the header file:
>>> >
>>> > ? ? ?itkSymmetricForcesDemonsRegistrationFilter.h
>>> >
>>> >
>>> > <quote>
>>> > * This class was contributed by Corinne Mattmann, ETH Zurich,
>>> > Switzerland.
>>> > ?* based on a variation of the DemonsRegistrationFilter. The basic
>>> > modification
>>> > ?* is to use equation (5) from Thirion's paper along with the
>>> > modification for
>>> > ?* avoiding large deformations when gradients have small values.
>>> > ?*
>>> > ?* SymmetricForcesDemonsRegistrationFilter implements the demons
>>> > deformable algorithm that
>>> > ?* register two images by computing the deformation field which will map
>>> > a
>>> > ?* moving image onto a fixed image.
>>> > </quote>
>>> >
>>> >
>>> > Is this the information that you are looking for ?
>>> >
>>> >
>>> > The difference in computation time is due to the fact that this
>>> > class computes gradients of both the Fixed image and the
>>> > Moving image.
>>> >
>>> >
>>> >
>>> > ? ? ?Regards,
>>> >
>>> >
>>> > ? ? ? ? ? ? Luis
>>> >
>>> >
>>> >
>>> >
>>> > --------------------------------------------------------------------------------------
>>> > On Wed, Feb 17, 2010 at 2:15 PM, Zoltan Seress <seress.zoltan at gmail.com>
>>> > wrote:
>>> >>
>>> >> Hi all,
>>> >> I have browsed the classes of itk 3.16 to get some information about
>>> >> the
>>> >> variants of the demons registration. I have found these:
>>> >> 1, itkDemonsRegistrationFilter: this is the one algorithm by
>>> >> Thirion:?"Image
>>> >> matching as a Diffusion Process: and Analogy with Maxwell's Demons"
>>> >> 2, itkPointSetToSpatialObjectDemonsRegistration:?this is another
>>> >> algorithm
>>> >> by Thirion
>>> >> 3, itkDiffeomorphicDemonsRegistrationFilter: it is presented by
>>> >> Vercauteren
>>> >> (http://hdl.handle.net/1926/510) Algorithm 3 should be this one.
>>> >> 4,?itkFastSymmetricForcesDemonsRegistrationFilter:?it is also presented
>>> >> by
>>> >> Vercauteren (http://hdl.handle.net/1926/510) Algorithm 2 should be this
>>> >> one.
>>> >> 5,?itkSymmetricForcesDemonsRegistrationFilter: There is no additional
>>> >> info
>>> >> in the description. Has not been this implementation published
>>> >> somewhere?
>>> >> All I know that it uses both the moving image gradient and the fixed
>>> >> image
>>> >> gradient, and it is approximately 3 times slower
>>> >> than?itkDemonsRegistrationFilter. Can you tell me more about this
>>> >> filter?
>>> >> PS: I know about other variants such as log-domain diffeomorphic demons
>>> >> and
>>> >> symmetric?log-domain diffeomorphic demons, but these are too much for
>>> >> once.
>>> >> --
>>> >> Zoli
>>> >>
>>> >> _____________________________________
>>> >> 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.html
>>> >>
>>> >> 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.html
>>> >
>>> > 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
>>> >
>>
>>
>>
>> --
>> Zoli
>>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 18 Feb 2010 11:17:10 +0200 (EET)
> From: Lassi Paavolainen <lassi.paavolainen at jyu.fi>
> Subject: Re: [Insight-users] Reading LSM images
> To: Luis Ibanez <luis.ibanez at kitware.com>
> Cc: ITK mailing list <insight-users at itk.org>,   Curtis Rueden
>        <ctrueden.wisc at gmail.com>,      Jesse Stokum <jessestokum at gmail.com>
> Message-ID: <alpine.LRH.2.00.1002181112210.612 at jalava.cc.jyu.fi>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hi All,
>
> On Mon, 15 Feb 2010, Luis Ibanez wrote:
>
>> Hi Alex,
>>
>> Thanks for the reminder.
>>
>>
>> Jesse:
>>
>> You may want to look at bioimageXD
>> if you don't mind using GPL code:
>> http://www.bioimagexd.net/index.php?option=com_content&task=view&id=14&Itemid=28
>
> Actually the license of LSM reader was changed to be BSD license some time
> ago to make it easier for others (like gofigure2) to use it.
>
> Regards,
> Lassi
>
>> Otherwise,
>> you probably could use the vtkLSMReader
>> in gofigure2, that is under a BSD license,
>> as Alex pointed out.
>>
>>
>>
>>    Regards,
>>
>>
>>           Luis
>>
>>
>> -------------------------------------------------------
>> On Mon, Feb 15, 2010 at 11:46 AM, Alexandre GOUAILLARD
>> <agouaillard at gmail.com> wrote:
>>> hi luis, dan, all,
>>>
>>> luis, you might not remember that long thread we had about LSM reader,
>>> but the ITK one does not handle multi channels.
>>>
>>> Dan (and other from bioimageXD) made their vtkLSM reader available
>>> under BSD, and that s the one we eventually used for GoFigure. That
>>> the one gaethan is also using on a daily basis.
>>>
>>> As dan pointed out, the best reader, or the one including most
>>> functionaity and the most up to date, out there might be the one from
>>> OME, and curtis should have a wrapping between OME and ITK IO working
>>> (in cc).
>>>
>>> good luck.
>>>
>>> alex.
>>>
>>> On Sun, Feb 14, 2010 at 5:21 AM, Jesse Stokum <jessestokum at gmail.com> wrote:
>>>> Luis,
>>>>
>>>> I've surrounded my reader->update() line with a try, catch block that
>>>> catches itk::ExceptionObject. It doesn't seem to be even getting to
>>>> the catch block- simple std::cout statements inside the catch block
>>>> are not showing. The following unhandled exception appears however
>>>> when I run my program on the vs debugger:
>>>>
>>>> The thread 'Win32 Thread' (0x1a7c) has exited with code 0 (0x0).
>>>> Unhandled exception at 0x00b0a890 in CellSegment.exe: 0xC0000005:
>>>> Access violation writing location 0x08fc0040.
>>>>
>>>> The breakpoint that is detected by vs is in line 1116 of the class
>>>> itkTIFFImageIO.cxx.
>>>>
>>>> Thanks,
>>>>
>>>> Jesse
>>>>
>>>>
>>>>
>>>> On Sat, Feb 13, 2010 at 3:38 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>>>> Hi Jesse,
>>>>>
>>>>> Thanks for the clarification.
>>>>>
>>>>> You are right, if the 3D image is in a single file, then
>>>>> using the ImageFileReader is the correct way to
>>>>> proceed.
>>>>>
>>>>> Could you please post to the list the exact text
>>>>> that you get from the Exceptions ?
>>>>>
>>>>> If you need examples on how to catch exceptions
>>>>> and print their error messages, you will find many
>>>>> of them in the directories under
>>>>>
>>>>> ? ? ? ? ? ? ? ? ? ? Insight/Examples
>>>>>
>>>>>
>>>>> ? ? Thanks
>>>>>
>>>>>
>>>>> ? ? ? ? ? ? Luis
>>>>>
>>>>>
>>>>> -----------------------------------------------------------------
>>>>> On Sat, Feb 13, 2010 at 12:33 PM, Jesse Stokum <jessestokum at gmail.com> wrote:
>>>>>> Luis,
>>>>>>
>>>>>> Thanks for the quick reply, I really appreciate it. The lsm image
>>>>>> stack that I'm working with are actually all in a single file - which
>>>>>> is why I hesitated to use the ImageSeriesReader for this one. I
>>>>>> suppose I could always split the stack into a series of slices imagej
>>>>>> or something else, but it would be more time efficient to just read in
>>>>>> the entire file. Also, intuitively I think that I would get better
>>>>>> filtering results if I handled it as a 3d image, though I could be
>>>>>> wrong about that. Thanks!
>>>>>>
>>>>>> Jesse
>>>>>>
>>>>>> On Fri, Feb 12, 2010 at 5:07 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>>>>>> Hi Jesse,
>>>>>>>
>>>>>>>
>>>>>>> If you have the images in independent files (one file per slice),
>>>>>>> you should use the itk::ImageSeriesReader (instead of the
>>>>>>> itk::ImageFileReader).
>>>>>>>
>>>>>>>
>>>>>>> The LSM reader in ITK should be able to manage three channels
>>>>>>> (three components per pixel).
>>>>>>>
>>>>>>> You will find examples on how to use the ImageSeriesReader
>>>>>>> in the ITK Software Guide
>>>>>>>
>>>>>>> ? ? ? ? ? ? ? ? ? http://www.itk.org/ItkSoftwareGuide.pdf
>>>>>>>
>>>>>>> in the chapter "Reading and Writing Images",
>>>>>>>
>>>>>>> and you will find source code examples in the directory:
>>>>>>>
>>>>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? Insight/Examples/IO
>>>>>>>
>>>>>>> in particular, you may find interesting the example:
>>>>>>>
>>>>>>> ? ? ? ? ? ?RGBImageSeriesReadWrite.cxx
>>>>>>>
>>>>>>> you probably only need to replace there the PNGImageIO
>>>>>>> class with a LSMImageIO class.
>>>>>>>
>>>>>>>
>>>>>>> Please give it a try and let us know if you find any problems.
>>>>>>>
>>>>>>> BTW: I you get any Exceptions, please post to the list
>>>>>>> the *exact* error message that you get from the exception.
>>>>>>>
>>>>>>>
>>>>>>> ? ? Thanks
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ? ? ? ? ? Luis
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -------------------------------------------------------------------------------------
>>>>>>> On Fri, Feb 12, 2010 at 12:34 PM, Jesse Stokum <jessestokum at gmail.com> wrote:
>>>>>>>> I'm trying to use ITK's ImageFileReader to read in LSM format images
>>>>>>>> and my code is abruptly throwing exceptions. The images are three
>>>>>>>> channel, and are ~30 slices. Should I consider them 3d images? Here's
>>>>>>>> the code in my main() I've been trying:
>>>>>>>>
>>>>>>>> ? ? ? ?typedef itk::RGBPixel<unsigned char> PixelType;
>>>>>>>> ? ? ? ?typedef itk::Image<PixelType, 3> ImageType;
>>>>>>>>
>>>>>>>> ? ? ? ?typedef itk::ImageFileReader<ImageType> ReaderType;
>>>>>>>> ? ? ? ?typedef itk::LSMImageIO ImageIOType;
>>>>>>>> ? ? ? ?typedef itk::ImageFileWriter<ImageType> WriterType;
>>>>>>>>
>>>>>>>> ? ? ? ?ReaderType::Pointer reader = ReaderType::New();
>>>>>>>> ? ? ? ?ImageIOType::Pointer lsmImageIO = ImageIOType::New();
>>>>>>>> ? ? ? ?reader->SetImageIO(lsmImageIO);
>>>>>>>> ? ? ? ?reader->SetFileName("Tests.lsm");
>>>>>>>>
>>>>>>>> Are lsm pixels vector pixels? I guess I'm just unsure how to handle
>>>>>>>> this situation. Thanks in advance!
>>>>>>>> _____________________________________
>>>>>>>> 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.html
>>>>>>>>
>>>>>>>> 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.html
>>>>
>>>> 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.html
>>
>> 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
>>
>
> --
> Lassi Paavolainen, M.Sc
> Software Engineer, PhD Student in Computer Science
> BioImageXD (http://www.bioimagexd.net)
> University of Jyv?skyl?
> lassi.paavolainen at jyu.fi
>
> ------------------------------
>
> Message: 3
> Date: Thu, 18 Feb 2010 11:16:21 +0100
> From: Dan Mueller <dan.muel at gmail.com>
> Subject: Re: [Insight-users] ITK video on youtube
> To: martin.kavec at gmail.com
> Cc: insight-users at itk.org
> Message-ID:
>        <2b8d077d1002180216p4683b457k5ae5fc66c6b5ef68 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Martin,
>
> This looks like some form of watershed, though which flavor (normal,
> from markers, etc) I'm not sure.
>
> You may have to wait for the US users/developers to wake up for a more
> complete answer (sleepy heads! :P)
> Until then, the following link (taken from YouTube) may be useful:
>    http://www.insight-journal.org/browse/publication/70
>    http://www.insight-journal.org/download/viewslideshow/70/619121
>
> Cheers, Dan
>
> On 18 February 2010 07:44, Martin Kavec <martin.kavec at gmail.com> wrote:
>> Hi,
>>
>> anybody knows the application and the segmentation method used in segmenting
>> the menangioma on the following youtube video:
>>
>> http://www.youtube.com/watch?v=nXzdoQjyJKw&feature=related
>>
>> Thanks,
>>
>> Martin
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 18 Feb 2010 12:00:32 +0100
> From: Martin Kavec <martin.kavec at gmail.com>
> Subject: Re: [Insight-users] ITK video on youtube
> To: insight-users at itk.org
> Message-ID: <201002181200.33632.martin.kavec at gmail.com>
> Content-Type: Text/Plain;  charset="iso-8859-1"
>
> Hi Dan,
>
> thanks for the reply. From the links you sent I found, it is acctually
> implemented in the InsightApplications.
>
> Cheers,
> Martin
>
> On Thursday 18 February 2010 11:16:21 Dan Mueller wrote:
>> Hi Martin,
>>
>> This looks like some form of watershed, though which flavor (normal,
>> from markers, etc) I'm not sure.
>>
>> You may have to wait for the US users/developers to wake up for a more
>> complete answer (sleepy heads! :P)
>> Until then, the following link (taken from YouTube) may be useful:
>>     http://www.insight-journal.org/browse/publication/70
>>     http://www.insight-journal.org/download/viewslideshow/70/619121
>>
>> Cheers, Dan
>>
>> On 18 February 2010 07:44, Martin Kavec <martin.kavec at gmail.com> wrote:
>> > Hi,
>> >
>> > anybody knows the application and the segmentation method used in
>> > segmenting the menangioma on the following youtube video:
>> >
>> > http://www.youtube.com/watch?v=nXzdoQjyJKw&feature=related
>> >
>> > Thanks,
>> >
>> > Martin
>
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 18 Feb 2010 10:18:17 -0500
> From: Luis Ibanez <luis.ibanez at kitware.com>
> Subject: Re: [Insight-users] problem to convert a mesh to a Binary
>        image
> To: Noura AZZABOU <n.azzabou at institut-myologie.org>
> Cc: itk <Insight-users at itk.org>
> Message-ID:
>        <f7abd23c1002180718g1292ac0an315e3f8ed7f561c2 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Noura,
>
> Thanks for letting us know that this solved the problem.
>
>
>      Luis
>
>
> -----------------------------------------------------------
> On Thu, Feb 18, 2010 at 6:23 AM, Noura AZZABOU
> <n.azzabou at institut-myologie.org> wrote:
>> Hi Luiz,
>>
>> Thank you for you help it works now
>>
>>
>> Noura
>>
>> -----Message d'origine-----
>> De?: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>> Envoy??: 17 February 2010 21:26
>> ??: Noura AZZABOU
>> Cc?: itk
>> Objet?: Re: [Insight-users] problem to convert a mesh to a Binary image
>>
>> Hi Noura,
>>
>> Thanks for the clarification.
>>
>> The filter that you need then, is called:
>>
>> ? ? ? itkTriangleMeshToBinaryImageFilter
>>
>> http://www.itk.org/Doxygen/html/classitk_1_1TriangleMeshToBinaryImageFilter.html
>>
>>
>> You will find it in the directory:
>>
>> ? ? ? ? ? ?Insight/Code/BasicFilters
>>
>>
>> ? ?Regards,
>>
>>
>> ? ? ? ?Luis
>>
>>
>> --------------------------------
>> On Tue, Feb 16, 2010 at 4:25 AM, Noura AZZABOU
>> <n.azzabou at institut-myologie.org> wrote:
>>> Hi Luis,
>>>
>>> Thank you for your answer but my problem is the opposite I want to obtain a binary image from the mesh. Indeed, when I used the line code that I posted, the result was not as expected and I obtained a Binary image containing only the pixel belonging to the contour (and not those inside the contour. The result I obtained is similar (but thicker contours) to the one given by
>>>
>>> itk::PointSetToImageFilter<MeshType,ImageType> MeshFilterType;
>>>
>>> I can send you the resulting image and the corresponding mesh if it makes things more clear.
>>>
>>>
>>> Regards
>>>
>>> Noura
>>>
>>>
>>> -----Message d'origine-----
>>> De?: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>>> Envoy??: 15 February 2010 23:56
>>> ??: Noura AZZABOU
>>> Cc?: insight-users at itk.org
>>> Objet?: Re: [Insight-users] problem to convert a mesh to a Binary image
>>>
>>> Hi Noura,
>>>
>>> If you only want your binary mask to only have the pixels that
>>> are touched by the mesh, you can take the current binary mask
>>> that you got from the rasterization process and you can pass it
>>> as input to the
>>>
>>> ? ? ? ? ? ? ? itkSimpleContourExtractorImageFilter
>>>
>>> That should give you as output a binary mask that only contains
>>> the pixelized surface of the mesh.
>>>
>>> ---
>>>
>>> You can achieve a similar result by eroding the mask and
>>> subtracting it from the original one.
>>>
>>> ? ?Regards,
>>>
>>>
>>> ? ? ? ? ? ?Luis
>>>
>>>
>>>
>>> ---------------------------------------------------------------------------------
>>> On Mon, Feb 15, 2010 at 8:13 AM, Noura AZZABOU
>>> <n.azzabou at institut-myologie.org> wrote:
>>>> Hi,
>>>>
>>>>
>>>>
>>>> I am trying to convert a vtk mesh to a Binary image. I followed the examples
>>>> given in the ITK software guide. ?I used spatial object in order to obtain a
>>>> Binary image (1 inside the mesh) 0 outside.
>>>>
>>>> ?Instead of that I obtained an image with 1 for the pixel belonging to the
>>>> contour and 0 for the rest (inclusing the pixels that are inside the region
>>>> delimited by the contour)
>>>>
>>>>
>>>>
>>>> Does any body know if there are some condition on mesh to make the
>>>> generation of binary image possible.
>>>>
>>>>
>>>>
>>>> Here is the source code for the binary image generation.
>>>>
>>>>
>>>>
>>>> Thanks in advance for your help
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> typedef itk::Mesh< double, 3 > MeshType;
>>>>
>>>> ????? typedef itk::MeshSpatialObject< MeshType > SpatialObjectType;
>>>>
>>>> ????? typedef itk::Image< unsigned char, 3 > ImageType;
>>>>
>>>> ????? typedef itk::Image< double, 3> RefImageType;
>>>>
>>>> ????? typedef itk::SpatialObjectToImageFilter< SpatialObjectType, ImageType
>>>>> MeshFilterType;
>>>>
>>>> ????? typedef itk::VTKPolyDataReader< MeshType > MeshReaderType;
>>>>
>>>> ????? typedef itk::ImageFileWriter< ImageType > ImageWriterType;
>>>>
>>>> ????? typedef itk::ImageFileReader< RefImageType > RefImageReaderType;
>>>>
>>>>
>>>>
>>>> ????? /// load vtk mesh
>>>>
>>>> ????? std::cout << "load vtk mesh" << std::endl;
>>>>
>>>> ????? MeshReaderType::Pointer mesh_reader = MeshReaderType::New();
>>>>
>>>> ????? mesh_reader->SetFileName( mesh_path );
>>>>
>>>> ????? mesh_reader->Update();
>>>>
>>>> ????? SpatialObjectType::Pointer mesh = SpatialObjectType::New();
>>>>
>>>> ????? mesh->SetMesh( mesh_reader->GetOutput() );
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ????? /// reference image
>>>>
>>>> ????? std::cout << "load reference image" << std::endl;
>>>>
>>>> ????? RefImageReaderType::Pointer ref_image_reader =
>>>> RefImageReaderType::New();
>>>>
>>>> ????? ref_image_reader->SetFileName( ref_image );
>>>>
>>>> ????? ref_image_reader->Update();
>>>>
>>>> ????? ref_image_reader->GetOutput()->Print(std::cout);
>>>>
>>>>
>>>>
>>>> ????? /// image pointer
>>>>
>>>> ????? ImageType::Pointer image;
>>>>
>>>>
>>>>
>>>> ????? /// generate output image
>>>>
>>>> ????? std::cout << "generate output image" << std::endl;
>>>>
>>>> ????? MeshFilterType::Pointer mesh_filter = MeshFilterType::New();
>>>>
>>>> ????? mesh_filter->SetOrigin( ref_image_reader->GetOutput()->GetOrigin() );
>>>>
>>>> ????? mesh_filter->SetSize(
>>>> ref_image_reader->GetOutput()->GetLargestPossibleRegion().GetSize() );
>>>>
>>>> ????? mesh_filter->SetSpacing( ref_image_reader->GetOutput()->GetSpacing()
>>>> );
>>>>
>>>> ????? //mesh_filter->SetDirection(
>>>> ref_image_reader->GetOutput()->GetDirection() );
>>>>
>>>> ????? mesh_filter->SetOutsideValue(1);
>>>>
>>>> ????? mesh_filter->SetInsideValue(23);
>>>>
>>>> ????? mesh_filter->SetInput(mesh);
>>>>
>>>> ????? ref_image_reader->Delete();
>>>>
>>>> ????? try
>>>>
>>>> ????? {
>>>>
>>>> ??????????? mesh_filter->Update();
>>>>
>>>> ????? }
>>>>
>>>> ????? catch( itk::ExceptionObject & excep )
>>>>
>>>> ????? {
>>>>
>>>> ??????????? std::cerr << "Exception Caught !" << std::endl;
>>>>
>>>> ??????????? std::cerr << excep << std::endl;
>>>>
>>>> ????? }
>>>>
>>>> ????? // mesh_reader->GetOutput()->Print(std::cout);
>>>>
>>>> ????? // mesh->Print(std::cout);
>>>>
>>>> ????? // mesh->GetMesh()->Print(std::cout);
>>>>
>>>> ????? mesh_filter->GetInput()->Print(std::cout);
>>>>
>>>> ????? mesh_filter->Print(std::cout);
>>>>
>>>>
>>>>
>>>> ????? /// save image
>>>>
>>>> ????? std::cout << "save image" << std::endl;
>>>>
>>>> ????? ImageWriterType::Pointer image_writer = ImageWriterType::New();
>>>>
>>>> ????? std::cout << "saving image: " << image_path + "/" + image_name <<
>>>> std::endl;
>>>>
>>>> ????? image_writer->SetFileName( image_path + "/" + image_name );
>>>>
>>>> ????? image_writer->SetInput( mesh_filter->GetOutput() );
>>>>
>>>> ????? image_writer->Update();
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----------------------------------------------
>>>>
>>>> Noura Azzabou, PhD
>>>> Labo RMN AIM-CEA
>>>> Institut de Myologie - Bat Babinski
>>>> G.H. Pitie-Salpetriere, 83 Bd Hopital
>>>> 75651 Paris CEDEX 13, France
>>>> T?l. : 33 (0)1 42 16 58 92
>>>> Fax : 33 (0) 1 42 16 58 97
>>>>
>>>>
>>>>
>>>> _____________________________________
>>>> 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.html
>>>>
>>>> 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
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
> End of Insight-users Digest, Vol 70, Issue 67
> *********************************************
>


More information about the Insight-users mailing list