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.
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.
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
.
Thank you.