[Insight-users] FW:

raghu venkatram raghu_420 at hotmail.com
Tue, 02 Mar 2004 18:35:06 +0000


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<unsigned short,3> ImageNDType;
  typedef itk::Image<unsigned short,3> Image3DType;
  typedef itk::ImageSeriesReader<ImageNDType> 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/