[Insight-users] FW:

Luis Ibanez luis.ibanez at kitware.com
Wed, 03 Mar 2004 17:04:46 -0500


Hi Raghu,


Good news:   Your code works for me.


Bad news:    Your data seems to be the problem.



The fact that you are getting the warning about
the "no magic number" is a bad sign about the
compliance of your files with the DICOM standard.

You may want to get back to your data source
and complaint about the format used for your files.


Regards,


    Luis



----------------------
raghu venkatram wrote:

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