Bug in IO_-3.0.4, analyze files gets saved upside down

Hello Curtis,

I am writing you today because of a bug I’ve discovered in the plugin you are maintaining that allows the saving of analyze files (“Analyze…”). I’ve noticed that the files are being saved upside-down from their original orientation. Upon further inspection of the source code I’ve noticed that it flips all the images in the stack upside-down then initializes an instance of FileSaver to save it before flipping it back again (line 54~64 in Analyze_Writer.class). Is it possible for this to be fixed?

Sincerely,
Michael Chang

PS. I have a feeling that because Fiji is open source, this is something I could do as well, but I have no experience how to contribute to an open source project. thanks in advance!

In accordance with ImageJ’s support philosophy, may I please make this thread into a public community one?

Yes you may, I don’t mind. Thanks for the quick response!

@mcax It is possible. Unfortunately, I do not currently have the bandwidth to work on it myself.

The page How to contribute to an existing plugin or library offers a walkthrough on how to contribute changes to a plugin. If you get stuck, you can post your specific desired changes as a patch here on the forum, and someone else can commit them for you.

@mcax,

Are you sure its a bug?

The explicit flipping suggests there’s a reason for it (it’s easier to not-flip, after all), and file formats for medical images can get complicated. Off-hand, it might be that the flipping could be an attempt to deal with radiological vs neurological coordinates (?).

I just bring this up in case you’re not familiar with these conventions / difficulties.

Consider reaching out to Guy Williams (looks like this is the right one) who appears to have written the code originally.

John

EDIT: I presume you were referring to the code below with the explicit flipping right?

1 Like

Yeah that’s like lines of code I’m referring to. Across multiple machines and making all the Fijis installations are up-to-date, everytime I save an image stack then load it (the saved version) back up, every slice appears to have been flipped vertically. I have downloaded the source code and wrote a small plugin to test it, and when the “flipping” parts of the code are removed, the saved copies appear in the correct orientation when loaded.

Edit: The data sets that I have are CT scans of lung tissue. I am not very familiar with the technicalities of biomedical imaging and I’ll be sure to read up on the articles you’ve linked. Very good chance my interpretation of orientations is not inline with industry practice. (cs student on coop)

1 Like

Thank you, I’ll read up on the contribution process.

I didn’t totally get it before. Is this the current situation?

  1. Open an Analyze file with Fiji. (It has some orientation X)
  2. Save that image as another Analyze file.
  3. Open the new Analyze file (it has orientation Y - flipped relative to X)

if so, then that sure does sound like a bug. (Still good to read up on conventions)

John

1 Like

I notice this bug too. I’m saving a stack to FITS format and when I open it back up it is upside down. Is there a workaround @mcax?

Run Image › Transform › Flip Vertically before saving it?

Yes, that works. Unfortunately, I use the stack in multiple ways as part of a script and don’t want it flipped in some cases. I will probably have to make a copy that I flip and save.

1 Like