[Insight-users] FW:

raghu venkatram raghu_420 at hotmail.com
Wed, 03 Mar 2004 15:53:59 +0000


<html><div style='background-color:'><DIV class=RTE>
<P>Hi Luis,</P>
<P>I wish that was the problem, but i understand that the 0/1 flag is controls the ordering of the images. Also I have commented out the writing out part. For the time being i am just trying to read in the series from a directory which contains only one series and no other files. I see the filenames in the series, also it gives me the 'no magic number warning', for both dicom and dicom2iofactory. and after it spits out all the file names, it gives an abnormal program termination error. </P>
<P>Thanks</P>
<P>Raghu</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P><BR><BR>&nbsp;</P></DIV>
<DIV></DIV>&gt;From: Luis Ibanez <LUIS.IBANEZ at KITWARE.COM>
<DIV></DIV>&gt;To: raghu venkatram <RAGHU_420 at HOTMAIL.COM>
<DIV></DIV>&gt;CC: insight-users at itk.org 
<DIV></DIV>&gt;Subject: Re: [Insight-users] FW: 
<DIV></DIV>&gt;Date: Tue, 02 Mar 2004 17:53:09 -0500 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Hi Raghu, 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;The problem seems to be with the arguments that you 
<DIV></DIV>&gt;are passing to the program. Right now you are using 
<DIV></DIV>&gt;the example in: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp; Insight/Examples/IO/ 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DicomSeriesReadImageWriter.cxx 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;This program expects as argument: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp; 1) The directory where the DICOM files are 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp; 2) The filename of an output image file where the 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set of image slices will be saved as a 3D dataset. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp; 3) A *string identifying a dicom series* 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;You are passing: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp;F:\itk\data\MR\temp1\&nbsp;&nbsp;0 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;You are probably expecting the second argument "0" 
<DIV></DIV>&gt;to refer to the first series. That's not the case, 
<DIV></DIV>&gt;the program is taking "0" as the filename that you 
<DIV></DIV>&gt;want to use for saving the image data. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;You sould be passing something like 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp;F:\itk\data\MR\temp1&nbsp;&nbsp; myOutputImageFile.mhd 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;The reason why the program is printing out all the 
<DIV></DIV>&gt;series Ids is for making it easier for you to take 
<DIV></DIV>&gt;one of those strings and use it as second argument 
<DIV></DIV>&gt;to the&nbsp;&nbsp;program. So, in a second run you can do 
<DIV></DIV>&gt;something more specific like: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp;DicomSeriesReaderImageWriter.exe 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp; F:\itk\data\MR\temp1 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myOutputImageFile.mhd 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.3.12.2.1107.5.1.4.24515.4.0.6770456214062487 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;(all in a single line...) 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Where the last string "1.3.12.2...." is the identifier 
<DIV></DIV>&gt;of one of the series. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Once you save your DICOM data in a fileformat 
<DIV></DIV>&gt;such as Analyze of MetaImage, you will be ready 
<DIV></DIV>&gt;for start testing the ImageRegistration examples. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Deformable registration can easily take 40 minutes 
<DIV></DIV>&gt;if you are dealing with 3D datasets. 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;Did you use the Multi-Resolution framework ? 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp; Regards, 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Luis 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;---------------------- 
<DIV></DIV>&gt;raghu venkatram wrote: 
<DIV></DIV>&gt; 
<DIV></DIV>&gt;&gt;Hello, 
<DIV></DIV>&gt;&gt;I am using the dicom imageseriesreader, to read in a series of 
<DIV></DIV>&gt;&gt;dicom images. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;My program arguments are: 
<DIV></DIV>&gt;&gt;F:\itk\data\MR\temp1\&nbsp;&nbsp;0 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;I only have one series in this directory, and nothing other than 
<DIV></DIV>&gt;&gt;the dicom files 
<DIV></DIV>&gt;&gt;are in this directory. 
<DIV></DIV>&gt;&gt;Its reads through, gets the filenames in the series and gives an 
<DIV></DIV>&gt;&gt;"abnormal 
<DIV></DIV>&gt;&gt;program termination error". Debugging shows that the it crashes on 
<DIV></DIV>&gt;&gt;the second 
<DIV></DIV>&gt;&gt;file in the series. I would appreciate if anyone could help me out. 
<DIV></DIV>&gt;&gt;also i see 
<DIV></DIV>&gt;&gt;Chunyan had postes a similar problem. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;If i am able to read in a series of dicom images, i want to use one 
<DIV></DIV>&gt;&gt;of the 
<DIV></DIV>&gt;&gt;registration algorithms and pass the two series, I am not sure if 
<DIV></DIV>&gt;&gt;this would 
<DIV></DIV>&gt;&gt;give me 3d registration.&nbsp;&nbsp;I tried using the analyze format, with 
<DIV></DIV>&gt;&gt;deformable 
<DIV></DIV>&gt;&gt;registration, it takes close to 40 mins, which makes me think i am 
<DIV></DIV>&gt;&gt;doing 
<DIV></DIV>&gt;&gt;something wrong. I would be glad if somebody could help me sort 
<DIV></DIV>&gt;&gt;things out. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;All my dicom images are viewable using the QT viewr, MRICro. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;Thanks in advance 
<DIV></DIV>&gt;&gt;Raghu Venkatram 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;/*========================================================================= 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Program:&nbsp;&nbsp; Insight Segmentation &amp; Registration Toolkit 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Module:&nbsp;&nbsp;&nbsp;&nbsp;$RCSfile: DicomSeriesReadImageWrite.cxx,v $ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Language:&nbsp;&nbsp;C++ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Date: 2003/12/30 21:13:04 $ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Version:&nbsp;&nbsp; $Revision: 1.2 $ 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Copyright (c) Insight Software Consortium. All rights reserved. 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for 
<DIV></DIV>&gt;&gt;details. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; This software is distributed WITHOUT ANY WARRANTY; without 
<DIV></DIV>&gt;&gt;even 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; the implied warranty of MERCHANTABILITY or FITNESS FOR A 
<DIV></DIV>&gt;&gt;PARTICULAR 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; PURPOSE.&nbsp;&nbsp;See the above copyright notices for more 
<DIV></DIV>&gt;&gt;information. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;=========================================================================*/ 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;//&nbsp;&nbsp;Software Guide : BeginLatex 
<DIV></DIV>&gt;&gt;// 
<DIV></DIV>&gt;&gt;//&nbsp;&nbsp;This example illustrates how to read a DICOM series into a 
<DIV></DIV>&gt;&gt;volume 
<DIV></DIV>&gt;&gt;//&nbsp;&nbsp;and then save this volume in another file format. 
<DIV></DIV>&gt;&gt;// 
<DIV></DIV>&gt;&gt;//&nbsp;&nbsp;Software Guide : EndLatex 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;/*========================================================================= 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Program:&nbsp;&nbsp; Insight Segmentation &amp; Registration Toolkit 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Module:&nbsp;&nbsp;&nbsp;&nbsp;$RCSfile: itkDICOMImageSeriesTest.cxx,v $ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Language:&nbsp;&nbsp;C++ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$Date: 2003/09/10 14:30:10 $xgoto-l 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Version:&nbsp;&nbsp; $Revision: 1.5 $ 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;Copyright (c) Insight Software Consortium. All rights reserved. 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for 
<DIV></DIV>&gt;&gt;details. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; This software is distributed WITHOUT ANY WARRANTY; without 
<DIV></DIV>&gt;&gt;even 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; the implied warranty of MERCHANTABILITY or FITNESS FOR A 
<DIV></DIV>&gt;&gt;PARTICULAR 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; PURPOSE.&nbsp;&nbsp;See the above copyright notices for more 
<DIV></DIV>&gt;&gt;information. 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;=========================================================================*/ 
<DIV></DIV>&gt;&gt;#if defined(_MSC_VER) 
<DIV></DIV>&gt;&gt;#pragma warning ( disable : 4786 ) 
<DIV></DIV>&gt;&gt;#endif 
<DIV></DIV>&gt;&gt;#include "itkDICOMImageIOFactory.h" 
<DIV></DIV>&gt;&gt;#include "itkDICOMImageIO2.h" 
<DIV></DIV>&gt;&gt;#include "itkImageSeriesReader.h" 
<DIV></DIV>&gt;&gt;#include "itkDICOMSeriesFileNames.h" 
<DIV></DIV>&gt;&gt;#include "itkAnalyzeImageIO.h" 
<DIV></DIV>&gt;&gt;#include "itkImageFileWriter.h" 
<DIV></DIV>&gt;&gt;#include 
<DIV></DIV>&gt;&gt;"F:/itk/InsightToolkit-1.4.0/Testing/Code/BasicFilters/itkFilterWatcher.h" 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;int main(int ac, char* av[]) 
<DIV></DIV>&gt;&gt;{ 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;typedef itk::AnalyzeImageIO ImageIOType; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;if(ac &lt; 3) 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;{ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;std::cerr &lt;&lt; "Usage: " &lt;&lt; av[0] &lt;&lt; " DicomDirectory 
<DIV></DIV>&gt;&gt;ReverseOrder(0/1)\n"; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;} 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;typedef itk::Image<UNSIGNED short,3> ImageNDType; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;typedef itk::Image<UNSIGNED short,3> Image3DType; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;typedef itk::ImageSeriesReader<IMAGENDTYPE> ReaderType; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;itk::DICOMImageIO2::Pointer io = itk::DICOMImageIO2::New(); 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;// Get the DICOM filenames from the directory 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;itk::DICOMSeriesFileNames::Pointer names = 
<DIV></DIV>&gt;&gt;itk::DICOMSeriesFileNames::New(); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;names-&gt;SetDirectory(av[1]); 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;ReaderType::Pointer reader = ReaderType::New(); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;reader-&gt;SetFileNames(names-&gt;GetFileNames()); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;reader-&gt;SetImageIO(io); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;std::cout &lt;&lt; names; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp; FilterWatcher watcher(reader); 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;try 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;{ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;if (atoi(av[2])) 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reader-&gt;ReverseOrderOn(); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;reader-&gt;Update(); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;reader-&gt;GetOutput()-&gt;Print(std::cout); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;} 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;catch (itk::ExceptionObject &amp;ex) 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;{ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; ex; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;} 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;/* 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;typedef itk::ImageFileWriter&lt; Image3DType &gt; WriterType; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; WriterType::Pointer writer = WriterType::New(); 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&nbsp;&nbsp;&lt;&lt; "Writing the image as " &lt;&lt; std::endl &lt;&lt; 
<DIV></DIV>&gt;&gt;std::endl; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&nbsp;&nbsp;&lt;&lt; av[2] &lt;&lt; std::endl &lt;&lt; std::endl; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;SetFileName( "out.hdr" ); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; ImageIOType::Pointer analyzeIO = ImageIOType::New(); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;SetImageIO(analyzeIO); 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;SetInput( reader-&gt;GetOutput() ); 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; try 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;{ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer-&gt;Update(); 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;} 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (itk::ExceptionObject &amp;ex) 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;{ 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;std::cout &lt;&lt; ex; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_FAILURE; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;} 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;*/ 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;&nbsp;&nbsp;return EXIT_SUCCESS; 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;} 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;_________________________________________________________________ 
<DIV></DIV>&gt;&gt;Fast. Reliable. Get MSN 9 Dial-up - 1 month FREE! (Limited-time 
<DIV></DIV>&gt;&gt;Offer) http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/ 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt;&gt;_______________________________________________ 
<DIV></DIV>&gt;&gt;Insight-users mailing list 
<DIV></DIV>&gt;&gt;Insight-users at itk.org 
<DIV></DIV>&gt;&gt;http://www.itk.org/mailman/listinfo/insight-users 
<DIV></DIV>&gt;&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV>&gt; 
<DIV></DIV></div><br clear=all><hr> <a href="http://g.msn.com/8HMAENUS/2737??PS=">Store more e-mails with MSN Hotmail Extra Storage – 4 plans to choose from!</a> </html>