Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bart copy does not behave like expected #341

Open
dabosch opened this issue Oct 16, 2024 · 0 comments
Open

bart copy does not behave like expected #341

dabosch opened this issue Oct 16, 2024 · 0 comments

Comments

@dabosch
Copy link

dabosch commented Oct 16, 2024

Hi,

the help of bart copy (bart copy -h) tells me what it supposedly does:

Copy an array (to a given position in the output file - which then must exist).

From this I assume that data from array a is copied into a position of array b, overwriting what's already in those positions, and implicitely not modifying the rest of array b.
However, when I use it, array b is actually completely cleared, and only the data from array b is still there. So either the description is unclear, or the behavior is not as intended.

I added a demo below.

Best,
Dario

Demo:

# generate a phantom
bart phantom -x128 phantom
bart toimg phantom phantom.png

phantom

#now extract the 2nd half of the phantom and scale it with factor 1.2 (make it a bit brighter)
bart extract 1 64 128 phantom phantom_right
bart scale 1.2 phantom_right phantom_right
bart toimg phantom_right phantom_right.png

phantom_right

# copy the scaled portion back into a copy of the original array
cp phantom.cfl phantom_copied.cfl
cp phantom.hdr phantom_copied.hdr
bart copy 1 64 phantom_right phantom_copied
bart toimg phantom_copied phantom_copied.png

phantom_new

I would expect the image to be a complete phantom, with the right half to be a bit brighter than the left half. Instead, the left half is completely lost.
For the intended result, I have to also extract the other portion of the data and stitch it together:

# join left and right half
bart extract 1 0 64 phantom phantom_left
bart toimg phantom_left phantom_left.png
bart join 1 phantom_left phantom_right phantom_joined  
bart toimg phantom_joined phantom_joined.png

phantom_joined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant