append is not working well. it is copying the same slice all the time

hello

i think the append is not doing it well, i want to append the slices in a image to visualize the slices and i think it only copies one slice in all the stack. How can i see the slices one by one to know if it is doing it fine. Is there any other way to add slices in an image without three loops and iterating?. Thanks

for(each slice…){
//Append the slices into an image
append1->AddInputData(reslice->GetOutput());
append1->SetAppendAxis(2);
append1->SetPreserveExtents(1);

	//append1->SetInputData(j, reslice->GetOutput());
	append1->UpdateInformation();
	append1->Update();

}

Try shallow-copying the reslice output into a new instance and adding that instance to the append: in the loop above you’re always appending the same data object. Algorithms update the contents of their output object, not the output object itself.

Thank you it works now !!