Closed adnanmunawar closed 1 year ago
Curious incurious, I tested with ~/Documents
folder instead of ~/Documents/adf_volume
and I don't see the same error. Hmmm!!!
Nevermind, that is because I already had a volume.yaml
file in there, so the issue is the same.
Hmmm. This will be fun to chase down... Probably some change that crept in with the last fix.
Not sure when I can get to it, should be fairly easy to read through the Python code if you have bandwidth. Like you said it really looks like an issue with the workflow order.
Found the culprit. This line (https://github.com/htp2/ambf_util_slicer_plugin/blob/master/AMBF_utils.py#L506). The data_size
and dimensions
are not the same, and I see that the x
and y
are flipped between the two. Is this due to LPS
vs RAS
or just the way Slicer stores arrays?
Ah, my unofficial test volume was probably "square" in x and y so this wasn't picked up with the last change...
The switch is explained in the block of text above: line ~493. Basically, the 2D slice pixel origin and width/height vs height/width definitions are different, so to get things to load correctly, the matrix gets rearranged a bit including "x" and "y" flipping. This is where using i,j,k instead of x,y,z for voxel indexes / dimensions would have been much better!
It's a bit confusing , but I think just for the size check dimensions[0] and dimensions[1] should flip. However, realistically, the check might not even be needed and currently is giving a false positive.
Either that or there's actually a miss here and we have to change the logic a bit for these i =/= j cases. If you comment out the test for now, does everything work?
Yes that makes sense. I kept the check and just removed the return
statement to let the method run till the end and save the ADF file and then it seems to work. Please see the PR above.
Fixed in #12
Hi Henry,
I think there may be some confusion in the workflow of saving the ADF file. I completed all the steps as I previously did but somehow ended up with these errors.
This is output in the Python console.
This is what my configuration looks like:
I checked and I do have the directory
~/Documents/adf_volume
.Another thing to note is that even though I only clicked
Export LabelMap to PNGs for AMBF
, the Python console shows the methodonRefreshYamlButton
was called. Is this the intended behavior? If so, would it not cause issues if a file does not already exist?