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

**URL:** https://discourse.vtk.org/t/append-is-not-working-well-it-is-copying-the-same-slice-all-the-time/612
**Category:** Support
**Created:** [March 26, 2019, 11:39pm UTC](https://discourse.vtk.org/t/append-is-not-working-well-it-is-copying-the-same-slice-all-the-time/612 "2019-03-26T23:39:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [March 26, 2019, 11:39pm UTC](https://discourse.vtk.org/t/append-is-not-working-well-it-is-copying-the-same-slice-all-the-time/612/1 "2019-03-26T23:39:26Z")

</div>

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();

```

}

---

<div class="post-metadata">

### Author: ![andreasbuykx](https://discourse.vtk.org/user_avatar/discourse.vtk.org/andreasbuykx/32/8137_2.png) [@andreasbuykx](https://discourse.vtk.org/u/andreasbuykx)
#### Post date: [March 31, 2019, 7:31am UTC](https://discourse.vtk.org/t/append-is-not-working-well-it-is-copying-the-same-slice-all-the-time/612/2 "2019-03-31T07:31:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [April 1, 2019, 11:04am UTC](https://discourse.vtk.org/t/append-is-not-working-well-it-is-copying-the-same-slice-all-the-time/612/3 "2019-04-01T11:04:22Z")

</div>

Thank you it works now !!
