Append 2 volumes change in resolution?

(Shrabani Ghosh) #1

I am trying to Append 2 volumes. But thereafter I can see that the resolution has changed a lot. Why did this happen? These pictures are before and after.

15 16

(Dženan Zukić) #2

What code are you using to append them? It is hard to judge from screenshots what changed regarding resolution. The change in pixel intensities is obvious - is that what you are asking?

(Shrabani Ghosh) #3

I need the pixel intensity same. I don’t want change in intensities. Is that any other way to do that?

#include “itkImageFileReader.h”
#include “itkImageFileWriter.h”
#include “itkTileImageFilter.h”

int main( int argc, char* argv[] )
{

const char * inputFileName1 = “input2.nii”;
const char * inputFileName2 = “input1.nii”;
const char * outputFileName = “output.nii”;

const unsigned int Dimension = 3;

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

typedef itk::ImageFileReader< ImageType >ReaderType;
ReaderType::Pointer reader1 = ReaderType::New();
reader1->SetFileName( inputFileName1 );

typedef itk::ImageFileReader< ImageType >ReaderType;
ReaderType::Pointer reader2 = ReaderType::New();
reader2->SetFileName( inputFileName2 );

typedef itk::TileImageFilter< ImageType, ImageType >TileFilterType;
TileFilterType::Pointer tileFilter = TileFilterType::New();
tileFilter->SetInput( 0, reader1->GetOutput() );
tileFilter->SetInput( 1, reader2->GetOutput() );
TileFilterType::LayoutArrayType layout;
layout[0] = 1;
layout[1] = 1;
layout[2] = 2;
tileFilter->SetLayout( layout );

typedef itk::ImageFileWriter< ImageType >WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( outputFileName );
writer->SetInput( tileFilter->GetOutput() );
try
{
writer->Update();
}
catch( itk::ExceptionObject & error )
{
std::cerr << "Error: " << error << std::endl;
return EXIT_FAILURE;
}

return EXIT_SUCCESS;
}

(Dženan Zukić) #4

I think this is your problem. You must use the pixel type which is big enough for pixel intensities of both images. Try short or unsigned short.

1 Like
(Shrabani Ghosh) #5

Thank you.