Append 2 volumes change in resolution?

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

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?

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;
}

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

Thank you.