Moti Freiman | 1 Jan 2009 12:51
Picon
Picon
Favicon

Re: converting mesh to binary image

Hi,
Thanks for reply, You were right,
We have some bug in the origin details, and when we fixed it, it worked great.
Many thanks,
Moti

On Wed, Dec 31, 2008 at 8:17 PM, Luis Ibanez <luis.ibanez-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org> wrote:

Hi Moti,

Please print out the values of:

    orgSpacing
    orgOrigin
    orgSize
    orgIndex

just before you pass them to the meshFilter.

It is likely that the values in "orgSize" are zeros.


Please let us know what you find.


    Thanks


    Luis


---------------------
Moti Freiman wrote:
Hi,
I'm trying to convert a 3d surface (got as some segmentation result) to a binary image, for comparison between different segmentations.
I build a mesh from points and triangles which I got and save it as a vtk polygonal data. It performs well and I can visualize it properly using paraview.
However, when I'm trying to convert it to a 3D binary volume using itkTriangleMeshToBinaryImageFilter I got the following exception:
 ------------------------------------------------------ start of output -------------------------------------------------------------------------
ExceptionObject caught !

itk::ExceptionObject (012CFB38)
Location: "void __thiscall itk::TriangleMeshToBinaryImageFilter<class itk::Mesh<unsigned char,3,class itk::DefaultStaticMeshTraits<unsigned char,3,3,float,float,unsigned char> >,class itk::Image<unsigned char,3>  >::GenerateData(void)"
File: e:\libs\insighttoolkit-3.10.0\code\basicfilters\itkTriangleMeshToBinaryImageFilter.txx
Line: 224
Description: itk::ERROR: TriangleMeshToBinaryImageFilter(038FD670): No Image Indices Found.


Press any key to continue



------------------------------------------------------- end of output -------------------------------------------------------------------------

My code is below,

------------------------------------------------------ start of code-------------------------------------------------------------------------
#include "itkVTKPolyDataWriter.h"
#include "itkVTKPolyDataReader.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkCastImageFilter.h"


#include "itkMesh.h"
#include "itkTriangleCell.h"
#include <fstream>


#include "itkTriangleMeshToBinaryImageFilter.h"



int main( int argc, char **argv )
{      char *points_name = NULL, *faces_name = NULL, *output_mesh = NULL,  *input_image = NULL, *output_name = NULL;
 
 
   points_name  = argv[1];
   faces_name = argv[2];
   output_mesh  = argv[3];
   input_image = argv[4];
   output_name = argv[5];
 
   typedef short PixelType;
   typedef unsigned char OutputPixelType;
   const unsigned int          Dimension = 3;

     typedef itk::Mesh <OutputPixelType, Dimension> itkMeshType;

   itkMeshType::Pointer mesh = itkMeshType::New();
         std::fstream pointsReader;
   pointsReader.open (points_name, std::ios::in);
   int i=0;
   while (pointsReader.peek () != EOF)
   {
       itkMeshType::PointType p;
       pointsReader >> p[0] >> p[1] >> p[2];
       mesh->SetPoint (i,p);
       ++i;
   }
   pointsReader.close();
     typedef itkMeshType::CellType CellType;
   typedef itk::TriangleCell < CellType > FaceType;

   typedef CellType::CellAutoPointer CellAutoPointer;



   std::fstream facesReader;
   facesReader.open (faces_name, std::ios::in);
     i=0;
   while (facesReader.peek () != EOF)
   {
       int p[3];
       facesReader >> p[0] >> p[1] >> p[2];
             CellAutoPointer face;
       face.TakeOwnership( new FaceType );

       face->SetPointId (0, p[0]);
       face->SetPointId (1, p[1]);
       face->SetPointId (2, p[2]);

       mesh->SetCell (i,face);
       ++i;
   }
   facesReader.close();
   mesh->Update();

 
 
     typedef itk::VTKPolyDataWriter<itkMeshType> itkVTKPolyDataWriterType;

   itkVTKPolyDataWriterType::Pointer meshWriter = itkVTKPolyDataWriterType::New();
   meshWriter->SetFileName( output_mesh );
   meshWriter->SetInput (mesh);
   try
   {
       meshWriter->Update();
   }
   catch ( itk::ExceptionObject &err)
   {
       std::cout << "ExceptionObject caught !" << std::endl;
       std::cout << err << std::endl;
       return -1;
   }

 

   typedef itk::Image< PixelType, Dimension > ImageType;
   typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
     typedef itk::ImageFileReader< ImageType > ImageReaderType;





   // Read the input files
   ImageReaderType::Pointer reader = ImageReaderType::New();
   reader->SetFileName( input_image );
   try
   {
       reader->Update();
   }
   catch ( itk::ExceptionObject &err)
   {
       std::cout << "ExceptionObject caught !" << std::endl;
       std::cout << err << std::endl;
       return -1;
   }

 
   ImageType::Pointer orgImage = reader->GetOutput();
     const ImageType::PointType & orgOrigin = orgImage->GetOrigin();
   const ImageType::SizeType & orgSize = orgImage->GetLargestPossibleRegion().GetSize();
   const ImageType::SpacingType & orgSpacing = orgImage->GetSpacing();
   const ImageType::IndexType &orgIndex = orgImage->GetLargestPossibleRegion().GetIndex();
     

   typedef itk::TriangleMeshToBinaryImageFilter <itkMeshType, OutputImageType> itkTriangleMeshToBinaryImageFilterType;
   itkTriangleMeshToBinaryImageFilterType::Pointer meshFilter = itkTriangleMeshToBinaryImageFilterType::New();
   meshFilter->SetTolerance (1.0);
   meshFilter->SetSpacing (orgSpacing);
   meshFilter->SetOrigin(orgOrigin);
   meshFilter->SetSize (orgSize);
   meshFilter->SetIndex (orgIndex);
   meshFilter->SetInput(mesh);
       try
   {
       meshFilter->Update();
   }
   catch ( itk::ExceptionObject &err )
   {
       std::cout << "ExceptionObject caught !" << std::endl;
       std::cout << err << std::endl;
       return -1;
   }
           // Write the output image containing the binary volume.
   typedef itk::ImageFileWriter< OutputImageType > WriterType;
   WriterType::Pointer writer = WriterType::New();
   writer->SetInput( meshFilter->GetOutput() );
   writer->SetFileName( output_name );
   try
   {
       writer->Update();
   }
   catch ( itk::ExceptionObject &err )
   {
       std::cout << "ExceptionObject caught !" << std::endl;
       std::cout << err << std::endl;
       return -1;
   }

   return 0;   }

------------------------------------------------------ end of code-------------------------------------------------------------------------

Thanks for any help,
Moti
--
__
Moti Freiman, Ph.D Student.
Medical Image Processing and Computer-Assisted Surgery Laboratory.
School of Computer Science and Engineering.
The Hebrew University of Jerusalem Givat Ram, Jerusalem 91904, Israel
Phone: +(972)-2-658-5371 (laboratory)
WWW site: http://www.cs.huji.ac.il/~freiman


------------------------------------------------------------------------

_______________________________________________
Insight-users mailing list
Insight-users-RyaoCGfWeh4@public.gmane.org
http://www.itk.org/mailman/listinfo/insight-users



--
__
Moti Freiman, Ph.D Student.
Medical Image Processing and Computer-Assisted Surgery Laboratory.
School of Computer Science and Engineering.
The Hebrew University of Jerusalem Givat Ram, Jerusalem 91904, Israel
Phone: +(972)-2-658-5371 (laboratory)
WWW site: http://www.cs.huji.ac.il/~freiman
_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Maximilien Renard | 1 Jan 2009 15:19
Picon

Re: ConnectedThresholdImageFilter on one slice only ?

Hi Luis,

1) Yes

2) Yes

What I'm not able to do is using the PasteImageFilter which (if I'm
right) should copy the output of the ConnectedThresholdFilter on the
original image in the the 3D image.

I've tried to do that with the code pasted below but it didn't work.
CVolumeData SliceVolume contains the ITK 3D Image and the class where
this code is written is CVolumeData.

		typedef itk::PasteImageFilter< ITK3DImageType, ITK3DImageType,
ITK3DImageType > ImageReplacementFilterType;
		ImageReplacementFilterType::Pointer ImageReplacementFilter =
ImageReplacementFilterType::New();

		ImageReplacementFilter->SetInput(SliceVolume.GetITK3DImage());
		ImageReplacementFilter->SetSourceImage(SliceVolume.GetITK3DImage());
		ImageReplacementFilter->SetDestinationImage(GetITK3DImage());

		ImageReplacementFilter->SetDestinationIndex(start);
		ImageReplacementFilter->Update();

When trying to execute the program, I've got this error :

		Qt has caught an exception thrown from an event handler. Throwing
		exceptions from an event handler is not supported in Qt. You must
		reimplement QApplication::notify() and catch all exceptions there.
		
		terminate called after throwing an instance of
'itk::InvalidRequestedRegionError'
		what():  /home/ixm/InsightToolkit-3.8.0/Code/Common/itkDataObject.cxx:397:
		Requested region is (at least partially) outside the largest possible region.
		The program has unexpectedly finished.

What am I doing wrong ?

Thanks a lot and I wish you an happy new year.

Maximilien

2008/12/31 Luis Ibanez <luis.ibanez@...>:
>
> Hi Maximilien,
>
> Let's cut the problem in pieces...
>
>   1) Have you managed to extract one 2D slice
>      from the input 3D image, using the ExtractImageFilter ?
>
>   2) Did you manage to run the ConnectedThreshold filter
>      in the 2D slice ?
>
> Please let us know,
>
>
>    Thanks
>
>
>       Luis
>
>
> -------------------------
> Maximilien Renard wrote:
>>
>> Hi there again,
>>
>> Can't anybody please tell me how I can get this to work or what I'm
>> doing wrong, I've tried several times to read the doc and I
>> unfortunately still don't understand what I should do.
>>
>> I would really appreciate any little help.
>>
>> Thanks a lot,
>>
>> Maximilien
>>
>> P.S. Right before I wanted to send this e-mail, I've just noticed I
>> would have sent this e-mail (like the other one just here below) to
>> Luis Ibanez only. This was a mistake :)
>>
>> 2008/12/26 Maximilien Renard <iixamaxii@...>:
>>
>>> Hi Luis,
>>>
>>> Thank you for your answer, I was actually using a self-made method
>>> that was using GetBufferPointer(). This method was called for each
>>> voxel of the image which is probably why it was slow.
>>>
>>> Now, I'm trying to use the ImagePasteFilter but I must say, I couldn't
>>> understand how it should be used. I've made following :
>>>
>>> SliceVolume.Fill3D(X, Y, 0, LowThreshold, HighThreshold,
>>> ReplacementValue); // Which then contains the image with the selected
>>> region filled
>>>
>>> typedef itk::PasteImageFilter< ITK3DImageType, ITK3DImageType,
>>> ITK3DImageType > ImageReplacementFilterType;
>>> ImageReplacementFilterType::Pointer ImageReplacementFilter =
>>> ImageReplacementFilterType::New();
>>>
>>> ImageReplacementFilter->SetInput(SliceVolume.GetITK3DImage());
>>> ImageReplacementFilter->SetSourceImage(SliceVolume.GetITK3DImage());
>>> ImageReplacementFilter->SetDestinationImage(GetITK3DImage());
>>>
>>> ImageReplacementFilter->SetDestinationIndex(start);
>>> ImageReplacementFilter->Update();
>>>
>>> If I try to use this, I'm getting this message :
>>>
>>> Qt has caught an exception thrown from an event handler. Throwing
>>> exceptions from an event handler is not supported in Qt. You must
>>> reimplement QApplication::notify() and catch all exceptions there.
>>>
>>> terminate called after throwing an instance of
>>> 'itk::InvalidRequestedRegionError'
>>> what():
>>>  /home/ixm/InsightToolkit-3.8.0/Code/Common/itkDataObject.cxx:397:
>>> Requested region is (at least partially) outside the largest possible
>>> region.
>>> The program has unexpectedly finished.
>>>
>>> I've searched a little bit on the internet if I can found some example
>>> of the use of this filter but I didn't find anything (maybe I'm
>>> missing something that would make the doc cristal clear for me ?)
>>>
>>> Anyway I really appreciate your help,
>>>
>>> Thank you very much,
>>>
>>> Maximilien
>>>
>>> 2008/12/25 Luis Ibanez <luis.ibanez@...>:
>>>
>>>> Hi Maximilien,
>>>>
>>>> The process you are describing seems to be a reasonable
>>>> way of doing this.
>>>>
>>>>
>>>> More specifically:
>>>>
>>>>  1) Extract the slice with the
>>>>
>>>>                  "ExtractImageFilter"
>>>>
>>>>  2) Run the connectedThresholdImageFilter
>>>>    in 2D on the extracted slice
>>>>
>>>>
>>>>  3) Copy the slice back to the image, using the
>>>>
>>>>            "PasteImageFilter"
>>>>
>>>>
>>>> I'm surprised to hear that the last part takes a lot of
>>>> time. It should take a couple of seconds at most.
>>>> Were you doing this by using ImageIterators ?
>>>> or were you using calls to SetPixel() and GetPixel() ?
>>>>
>>>> Please give it a try to the PasteImageFilter
>>>>
>>>> http://www.itk.org/Insight/Doxygen/html/classitk_1_1PasteImageFilter.html
>>>>
>>>> and let us know if you still experience any problems.
>>>>
>>>>
>>>>  Regards,
>>>>
>>>>
>>>>      Luis
>>>>
>>>>
>>>>
>>>> -------------------------
>>>> Maximilien Renard wrote:
>>>>
>>>>> Hi there,
>>>>>
>>>>> I'm trying to use ConnectedThresholdImageFilter on one slice of an 3D
>>>>> Image only (the result should be the original image exactly the same
>>>>> except the specified slice where we put the seed).
>>>>> Now I'm extracting the slice into a new 3D Image where it is alone,
>>>>> then I apply the filter and finally I copy every voxel of the filtered
>>>>> image one by one into the original one. But that takes a lot of time
>>>>> (the last step is very long).
>>>>>
>>>>> Is there a better way to do that ? I'm new to ITK and I'm not
>>>>> acknowledged with ITK Doxygen documentation which is quite hermetic
>>>>> for me (I was used to read documentations such as the one of PHP or
>>>>> Qt).
>>>>>
>>>>> Thanks for your future help,
>>>>>
>>>>> Best regards and merry christmas,
>>>>>
>>>>> Maximilien Renard
>>>>> _______________________________________________
>>>>> Insight-users mailing list
>>>>> Insight-users@...
>>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>>
>>>>
>>
>
Nora Nora | 1 Jan 2009 18:03
Picon
Favicon

Re: Problem in running MyProject.cxx in getting started II?

Thanks a lot Mr. Cemal Cagatay Bilgin, the example has perfectly executed exactly after correcting these 3 bugs!I appreciated yoyr help.
 
Nora

--- En date de : Mar 30.12.08, Cemal Cagatay Bilgin <bilgic-CXiM98XSapA3uPMLIKxrzw@public.gmane.org> a écrit :
De: Cemal Cagatay Bilgin <bilgic-CXiM98XSapA3uPMLIKxrzw@public.gmane.org>
Objet: Re: [Insight-users] Problem in running MyProject.cxx in getting started II?
À: nora_droit-Qt13gs6zZMY@public.gmane.org
Cc: insight-users-RyaoCGfWeh4@public.gmane.org
Date: Mardi 30 Décembre 2008, 22h20

Nora, 

there are 3 bugs in your code:
> typedef itk::ImageFileReader<Imagetype> ReaderType;
should be 
typedef itk::ImageFileReader<ImageType> ReaderType; 
Node the  ImageType  with the capital letters. 

the others are 
ReaderType::Pointer reader = ReaderType::New(); //
and reader->SetFileName. 

Your code should compile after you take care of these. 

Cagatay Bilgin



On Dec 30, 2008, at 8:58 AM, Nora Nora wrote:


Dear Andinet,
 
I got the error message posted in the last email when trying to run a new build. I have just repeated the building processus after deleting the first binary directory and copying the four files in source directory. Here is the error message wich  is the same :
I can't advance in my registration project without resolving this problem. May be the problem is in visual C++ version?As itkImageToVTKImageFilter.h is a part of itk applications and most applications are done in old vs versions??I'm using visual express 2008!! 
 Are threre any other way or other examples to connect ITK to VTK??
 
Thanks,
Nora
--- En date de : Mar 30.12.08, Andinet Enquobahrie <andinet.enqu-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org> a écrit :
De: Andinet Enquobahrie <andinet.enqu-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org>
Objet: Re: [Insight-users] Problem in running MyProject.cxx in getting started II?
À: nora_droit-Qt13gs6zZMY@public.gmane.org
Date: Mardi 30 Décembre 2008, 13h01

Nora- Start from a clean build tree and try again... > Thanks Andinet for response, > I copied these four files in the source directory with MyProject.cxx, here is the new error message I got : > 2>..\Myproject-source\myProject.cxx(10) : error C2065: 'Imagetype' : identificateur non déclaré > 2>..\Myproject-source\myProject.cxx(13) : error C2955: 'itk::ImageFileReader' : l'utilisation d'une classe modèle requiert une liste d'arguments modèle > 2> c:\program files\insighttoolkit-3.10.0\code\io\itkImageFileReader.h(93) : voir la déclaration de 'itk::ImageFileReader' > 2>..\Myproject-source\myProject.cxx(13) : error C2653: 'readertype' : n'est pas un nom de classe ni d'espace de noms > 2>..\Myproject-source\myProject.cxx(13) : error C3861: 'New' : identificateur introuvable > 2>..\Myproject-source\myProject.cxx(13) : error C2514: 'itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>' : la classe n'a aucun constructeur > 2>..\Myproject-source\myProject.cxx(16) : error C2678: '->' binaire : aucun opérateur trouvé qui accepte un opérande de partie gauche de type 'itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>' (ou il n'existe pas de conversion acceptable) > 2> c:\program files\insighttoolkit-3.10.0\code\common\itkSmartPointer.h(69): peut être 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const' > 2> lors de la tentative de mise en correspondance de la liste des arguments '(itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>)' > 2>..\Myproject-source\myProject.cxx(16) : error C2039: 'setFilename' : n'est pas membre de 'itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>' > 2>..\Myproject-source\myProject.cxx(17) : error C2678: '->' binaire : aucun opérateur trouvé qui accepte un opérande de partie gauche de type 'itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>' (ou il n'existe pas de conversion acceptable) > 2> c:\program files\insighttoolkit-3.10.0\code\common\itkSmartPointer.h(69): peut être 'TObjectType *itk::SmartPointer<TObjectType>::operator ->(void) const' > 2> lors de la tentative de mise en correspondance de la liste des arguments '(itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>)' > 2>..\Myproject-source\myProject.cxx(17) : error C2039: 'GetOutput' : n'est pas membre de 'itk::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>' > 2>Le journal de génération a été enregistré à l'emplacement "file://c:\Documents and Settings\PC.WORK-PC\Bureau\ITK-VTK\MyProject\MyProject-Bin\myProject.dir\Debug\BuildLog.htm" > 2>myProject - 9 erreur(s), 0 avertissement(s) > > Is the problem in including Lib or in adding namespace? > I will appreciate you help, > Nora > > --- En date de : *Lun 29.12.08, Andinet Enquobahrie /<andinet.enqu-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org>/* a écrit : > > De: Andinet Enquobahrie <andinet.enqu-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org> > Objet: Re: [Insight-users] Problem in running MyProject.cxx in > getting started II? > À: nora_droit-Qt13gs6zZMY@public.gmane.org > Date: Lundi 29 Décembre 2008, 22h14 > > Nora- > > Copy those files into your Project source directory ( where you > have MyProject.cxx ) NOT to your binary directory. > > > On Mon, Dec 29, 2008 at 5:04 PM, Nora Nora <nora_droit-Qt13gs6zZMY@public.gmane.org > <mailto:nora_droit-Qt13gs6zZMY@public.gmane.org>> wrote: > > Hi all ITK users, > I tried to run MyProject.cxx following instructions in > getting started II. Here are MyProjct.cxx and CmakeLists.txt > files : > PROJECT( myProject ) > FIND_PACKAGE ( ITK ) > IF ( ITK_FOUND ) > INCLUDE( ${USE_ITK_FILE} ) > ENDIF( ITK_FOUND ) > FIND_PACKAGE ( VTK ) > IF ( VTK_FOUND ) > INCLUDE( ${USE_VTK_FILE} ) > ENDIF( VTK_FOUND ) > INCLUDE_DIRECTORIES( ${myProject_SOURCE_DIR}) > ADD_EXECUTABLE( myProject myProject.cxx ) > TARGET_LINK_LIBRARIES ( myProject > ITKBasicFilters ITKCommon ITKIO > vtkRendering vtkGraphics vtkHybrid > vtkImaging vtkIO vtkFiltering vtkCommon > ) > #include "itkImage.h" > #include "itkImageFileReader.h" > #include "itkImageToVTKImageFilter.h" > > #include "vtkImageViewer.h" > #include "vtkRenderWindowInteractor.h" > > int main( int argc, char **argv) { > > typedef itk::Image<unsigned short,2> ImageType; > typedef itk::ImageFileReader<Imagetype> ReaderType; > typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType; > > ReaderType::Pointer reader = readertype::New(); > ConnectorType::Pointer connector = ConnectorType::New(); > > reader->setFilename( argv[1] ); > connector->SetInput( reader->GetOutput() ); > > vtkImageViewer * viewer = vtkImageViewer::New(); > vtkRenderWindowInteractor * renderWindowInteractor = > vtkRenderWindowInteractor::New(); > > viewer->SetupInteractor( renderWindowInteractor ); > viewer->SetInput( connector->GetOutput() ); > > viewer->Render(); > viewer->SetColorWindow( 255 ); > viewer->SetColorLevel( 128 ); > renderWindowInteractor->Start(); > > return 0; > } > > I have successively built it, but in running this error > message is chown : > Myproject-source\myProject.cxx(3) : fatal error C1083: > Impossible d'ouvrir le fichier include : > 'itkImageToVTKImageFilter.h' : No such file or directory > I have red the response of Luis in OSdir forum to such > problem that is as followed : > The files that you need are in InsightApplications/Auxiliary/vtk : > > itkImageToVTKImageFilter.h > itkImageToVTKImageFilter.txx > itkVTKImageToImageFilter.h > itkVTKImageToImageFilter.txx > > Copy these files into the directory where you are putting the > code of your example. > So I copied these files in the generated binary directory with > myProject.dsw. > But I stiil have the same error message?? > Can someone help me?? > Are there other examples on how connect ITK to VTK? > Thanks, > Nora > > > _______________________________________________ > Insight-users mailing list > Insight-users-RyaoCGfWeh4@public.gmane.org <mailto:Insight-users <at> itk..org> > http://www.itk.org/mailman/listinfo/insight-users > > > -- ========================================================== Andinet A. Enquobahrie, PhD R&D Engineer Kitware Inc. 28 Corporate Drive Clifton Park, NY 12065-8662 Phone: 518-371-3971 x124 www.kitware.com

_______________________________________________
Insight-users mailing list
Insight-users-RyaoCGfWeh4@public.gmane.org
http://www.itk.org/mailman/listinfo/insight-users


_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Nora Nora | 2 Jan 2009 14:36
Picon
Favicon

Re: Exemples on heart images registration?


Hi Luis,

I tried DeformableRegistration1.cxx and It worked correctly. My question now:

 Are there tools in VTK to visualize output files especially VectorDeformationField.MHD?

Would you orient me to some examples using .MHD and .hdr format?

Excuse me Luis for these stupid questions! I am  beginner in ITK-VTK.

Thanks,

Nora

--- En date de : Jeu 25.12.08, Luis Ibanez <luis..ibanez-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org> a écrit :

De: Luis Ibanez <luis.ibanez-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org>
Objet: Re: [Insight-users] Exemples on heart images registration?
À: nora_droit-Qt13gs6zZMY@public.gmane.org
Cc: Insight-users-RyaoCGfWeh4@public.gmane.org
Date: Jeudi 25 Décembre 2008, 22h24

Hi Nora, 1) ITK doesn't provide *specific* examples of registration for cardiac images. However, you will find a large set of *generic* image registration examples, that may be applicable for cardiac images. You will find them described in the ITK Software Guide http://www.itk.org/ItkSoftwareGuide.pdf and their source code in Insight/Examples/Registraition 2) Yes, ITK provides support for FEM-based image registration methods, in particular for deformable registration problems. Please take a look at: Insight/Examples/Registraition DeformableRegistration1.cxx DeformableRegistration11.cxx Regards, Luis -------------------- Nora Nora wrote: > Hi all, > Please Luis or Bill , does ITK contain exemples or applications on the registration of cardiac images? > My second question : does ITK support finite element method in performing elastic registration? > Thanks, > Nora > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Insight-users mailing list > Insight-users-RyaoCGfWeh4@public.gmane.org > http://www.itk.org/mailman/listinfo/insight-users

_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Nora Nora | 2 Jan 2009 14:39
Picon
Favicon

Can ITK read mat format files (matlab format) – Time testing tools ?

Hi all ITK users,

I have data in mat format witch I want to pass as input images in my registration process.

Could ITK read mat format or I must convert it?

I need to compare my registration algorithm with other registration techniques in term of accuracy and running time. I find such comparison in most registration papers using ITK-VTK software,but I don’t know how they did it.

Are there in ITK or VTK  tools that provide running time for an algorithm? Or,  are there ITK applications already developed for this purpose?

 Best regards,

Nora


_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Josu Maiora | 2 Jan 2009 16:18
Picon

Re: File format for ICP

Hello Luis,


I am trying to register segmented spinal canals. Could you give me an aproach to do that? 

Thanks,
Josu

2008/12/31 Luis Ibanez <luis.ibanez-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org>

Hi Josu,

ICP requires two sets of points as input.

You seem to have two images.

Therefore, in order to use ICP you must first extract from each of your images
a set of points representing the structure(s) that you want to register.

What anatomical structures  are you trying to register ?

  Please let us know,


        Thanks


                Luis


---------------------------------------------------------------------
On Wed, Dec 31, 2008 at 6:01 AM, Josu Maiora <jmaiora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi all,

I am trying to use the ICP registration with two 3D segmented images. I have them in mhd or vtk format (I got them with SNAP) and I need to get a point set in a txt file to use that registration. Is it right?

And then, how could I get a point set with a reasonable number of points?

Thanks,

Josu

**************************************************************************
Josu Maiora
University of the Basque Country
**************************************************************************

_______________________________________________
Insight-users mailing list
Insight-users-RyaoCGfWeh4@public.gmane.org
http://www.itk.org/mailman/listinfo/insight-users



_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Olivier Tournaire | 2 Jan 2009 16:45
Picon

Re: Apply a filter to a portion of image

Thank you Luis.

I think your approach is better than just an ExtractImageFilter.

Best regards and happy new year,

OIivier


--
Dr. Olivier Tournaire
MATIS - Institut Géographique National
73, Ave de Paris
94165 St Mandé cedex, France

tel: (+33) 1 43 98 80 00 - 71 25
fax: (+33) 1 43 98 85 81

2008/12/31 Luis Ibanez <luis.ibanez-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org>
Hi Olivier,

Do you want to put the processed region back into the original image ?

If so, you may want to use the pipeline:

    * RegionOfInterestImageFilter
    * your filter
    * PasteImageFilter


 Regards,


    Luis


--------------------------
Olivier Tournaire wrote:
Hi all,

I am wondering if it is possible to apply a filter only on a specified region of an image. For my purpose, i have a large image, and I want to apply a DiscreteGaussianImageFilter on a small part. What is the best way to do it ?

Best regards,

Olivier

--
Dr. Olivier Tournaire
MATIS - Institut Géographique National
73, Ave de Paris
94165 St Mandé cedex, France

tel: (+33) 1 43 98 80 00 - 71 25
fax: (+33) 1 43 98 85 81


------------------------------------------------------------------------


_______________________________________________
Insight-users mailing list
Insight-users <at> itk.org
http://www.itk.org/mailman/listinfo/insight-users

_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Luis Ibanez | 2 Jan 2009 19:01
Favicon
Gravatar

Re: File format for ICP

Hi Josu,

If you already have segmented the spinal canal,
then you could use the filter

http://public.kitware.com/Insight/Doxygen/html/classitk_1_1BinaryMask3DMeshSource.html

to extract the surface around each one  of the segmented structures,
and then you could use the output of each filter as inputs to the
ICP examples in

    Insight/Examples/Patented/

PS. Please note that the ICP patent has already expired.

Since the spinal canal is a long structure, I would expect it to
register easily using ICP.... as long as your segmentation have
not missed big portions of each.


Note also that, given the curvature of the spine, you may have
to use Transforms that allow for deformations, (e.g. beyond
the Rigid and Affinee 3D) transform.


     Regards,


          Luis


------------------------------------------------------------------

On Fri, Jan 2, 2009 at 10:18 AM, Josu Maiora <jmaiora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello Luis,

I am trying to register segmented spinal canals. Could you give me an aproach to do that? 

Thanks,
Josu

2008/12/31 Luis Ibanez <luis.ibanez-5opLkZggLXlBDgjK7y7TUQ@public.gmane.org>


Hi Josu,

ICP requires two sets of points as input.

You seem to have two images.

Therefore, in order to use ICP you must first extract from each of your images
a set of points representing the structure(s) that you want to register.

What anatomical structures  are you trying to register ?

  Please let us know,


        Thanks


                Luis


---------------------------------------------------------------------
On Wed, Dec 31, 2008 at 6:01 AM, Josu Maiora <jmaiora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi all,

I am trying to use the ICP registration with two 3D segmented images. I have them in mhd or vtk format (I got them with SNAP) and I need to get a point set in a txt file to use that registration. Is it right?

And then, how could I get a point set with a reasonable number of points?

Thanks,

Josu

**************************************************************************
Josu Maiora
University of the Basque Country
**************************************************************************

_______________________________________________
Insight-users mailing list
Insight-users-RyaoCGfWeh4@public.gmane.org
http://www.itk.org/mailman/listinfo/insight-users




_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
Sayan Pathak | 3 Jan 2009 04:31
Picon
Favicon

Opportunities at Microsoft Research

Hi all ITK users and Developers,

You may find the following link of interest. http://research.microsoft.com/en-us/collaboration/global/europe/open-phd-positions.aspx

 

Please visit the pages of my collaborators at Microsoft Research. There are some exciting opportunities for prospective graduate students. Please do not hesitate to ask questions if you have one.

Thanks,

Sayan

 

Sayan Pathak, PhD | Senior SDE | Imaging R&D

Health Solutions Group | Microsoft Corporation

Office: (425) 538-7386

Email: sayanpa-0li6OtcxBFHby3iVrkZq2A@public.gmane.org

www.microsoft.com/amalga

 

 

_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users
gmail | 3 Jan 2009 20:47
Picon

creating simplex mesh from segmentation

Hi

 

I want to create a simplex mesh from binary image (segmented volume) , with predefined resolution (e.g. if a voxel is 1x1x1 mm create a mesh with 5mm spacing between vertices)

 

I’ve used BinaryMask3DMeshSource to create a mesh and VTK to reduce the number of vertices.

 

I used the following code to do so :

 

                  typedef itk::DefaultStaticMeshTraits< double, 3, 3, double,double >                                   TriangleMeshTraits;

                  typedef itk::DefaultStaticMeshTraits< double, 3, 3, double,double >                                   SimplexMeshTraits;

                  typedef itk::Mesh< double, 3, TriangleMeshTraits >                                                    TriangleMeshType;

                  typedef itk::SimplexMesh< double, 3, SimplexMeshTraits >                                              SimplexMeshType;

 

                  // Transform the triangle mesh to vtk  mesh

                  typedef itkMeshTovtkPolyData< TriangleMeshType TriangleMeshToPolyDataType;

 

                  TriangleMeshToPolyDataType *meshToPolyData = new TriangleMeshToPolyDataType();

                  meshToPolyData->SetInput( INPUT_MESH );

 

                  // reduce vertices to 10%

                  vtkDecimatePro *decimator = vtkDecimatePro::New();

                  decimator->SetInput( meshToPolyData->GetOutput() );

                  decimator->SetTargetReduction( 0.1 );

                  decimator->PreserveTopologyOff();

                  decimator->SplittingOn();

                  decimator->BoundaryVertexDeletionOn();

                  decimator->SetMaximumError( VTK_DOUBLE_MAX );

                  decimator->Update();

 

                  typedef vtkPolyDataToitkMesh< TriangleMeshType >      PolyDataToTriangleMeshType;

                  PolyDataToTriangleMeshType *polyDataToMesh = new PolyDataToTriangleMeshType();

                  polyDataToMesh->SetInput( decimator->GetOutput() );

 

                  // Transform the triangle mesh to simplex mesh

                  typedef itk::TriangleMeshToSimplexMeshFilter< TriangleMeshType, SimplexMeshType >       TriangleToSimplexMeshType;

                  TriangleToSimplexMeshType::Pointer triangleToSimplex = TriangleToSimplexMeshType::New();

                  triangleToSimplex->SetInput( polyDataToMesh->GetOutput() );

                  triangleToSimplex->Update();

                  this->m_pMesh = triangleToSimplex->GetOutput();

 

here are my questions

1)      usually there are more than 10% of the vertices – how can I have less than 10% when I set it in the decimator ?

2)      I cannot set the spacing – need to be guessed from the data (in the above example I want 1/5*1/5*1/5 = 0.008, which is too low for the decimator  is there a method to do so ?

3)      is there a process (maybe through VTK) that creates a mesh with the desired resolution (e.g. if a voxel is 1x1x1 mm create a mesh with 5mm spacing between vertices)

 

 

Thanks

 

Ori Hay

 

_______________________________________________
Insight-users mailing list
Insight-users@...
http://www.itk.org/mailman/listinfo/insight-users

Gmane