[Insight-users] (no subject)

alex Dowson alexdowson at hotmail.com
Tue Sep 18 06:44:44 EDT 2012


Hi


1) I mean to say where is files from a_vm1455.raw to a_vm1905.raw ?  Is it same directory where you load VHPabdomen.mhd ?
2) Your input image VHPabdomen.mhd  is color or gray scale ?
3) After loading VHPabdomen.mhd do you want to produce slices or want to do any conversion ?

Your code is not complete . If you can tell exactly what you want to do then we can help.








 

From: shirani kannangara 
Sent: Tuesday, September 18, 2012 4:05 PM
To: alexdowson at hotmail.com 
Subject: Re:

Hi 
Sorry I am not very clear what you need.I have attached my .mhd file.Did you go through it .IF you need any clarification pl let me know.

Shirani

---------- Forwarded message ----------
From: shirani kannangara <mangalika673 at gmail.com>
Date: Tue, Sep 18, 2012 at 3:39 PM
Subject: 
To: alexdowson at hotmail.com
Cc: insight-users at itk.org




Thanks for your mail.I corrected some codes as you mentioned. But couldn't read rgb values using RGBSeriesImageReadWrite.cxx.Then I tried to read and write the image data(raw data -VHPAbdomen.mhd)in itk.codes are as follows.But it does not write all.MY raw data file is attached herewith.

#include "itkImage.h"
#include "itkImageSeriesReader.h"
#include "itkImageFileWriter.h"
#include "itkNumericSeriesFileNames.h"
#include "itkPNGImageIO.h"
   #include <iostream>
        #include <string>
   using namespace std;
    
int main(  int argc, char **argv[])

{
    if( argc <4 );
    
  {std::cout << "Usage: " << std::endl;
    std::cout<<argv[0] <<  " firstSliceValue lastSliceValue  outputImageFile " << std::endl;
   return EXIT_FAILURE;
    } 
   
  //std::cout<<"sliceValue:"<<std::endl;
  typedef unsigned char                       PixelType;
  const unsigned int Dimension = 3;

  typedef itk::Image< PixelType, Dimension>  ImageType;

  typedef itk::ImageSeriesReader< ImageType >  ReaderType;
  typedef itk::ImageFileWriter<   ImageType >  WriterType;


  ReaderType::Pointer reader = ReaderType::New();
  WriterType::Pointer writer = WriterType::New();

  const unsigned int first = 1;
  const unsigned int last  = 450;
  //char * outputFilename = argv[3];
   char**outputFilename=  argv[3];
 
  typedef itk::NumericSeriesFileNames NameGeneratorType;

  NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
 
  nameGenerator->SetSeriesFormat( "D:\\To_SMK\\VHPAbdomen%03d.mhd" );
  nameGenerator->SetStartIndex( first );
  nameGenerator->SetEndIndex( last);
  nameGenerator->SetIncrementIndex(1);

  reader->SetImageIO( itk::PNGImageIO::New() );

  reader->SetFileNames( nameGenerator->GetFileNames()  );
  writer->SetInput( reader->GetOutput() );
  writer->SetFileName("test.mhd");
try
    {
    writer->Update();
    }
  catch( itk::ExceptionObject & err )
    {
    std::cerr << "ExceptionObject caught !" << std::endl;
    std::cerr << err << std::endl;
    return EXIT_FAILURE;
    };
 
  return 0;

  }
 
OUTPUT 

D:\image\Debug>ImageReadWrite.exe
Usage:
0022D9E0 firstSliceValue lastSliceValue  outputImageFile

D:\image\Debug>ImageReadWrite.exe(1 450 test.mhd)
Usage:
00E71324 firstSliceValue lastSliceValue  outputImageFile

D:\image\Debug>ImageReadWrite.exe(1,450,test.mhd)
Usage:
0115131C firstSliceValue lastSliceValue  outputImageFile

D:\image\Debug>


Thankas 

Shirani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120918/72121214/attachment.htm>


More information about the Insight-users mailing list