scipion-em / scipion-em-aretomo

Plugin to use AreTomo within the Scipion framework
GNU General Public License v3.0
2 stars 0 forks source link

Aretomo reconstruction is not working when you enter with Imod alignment #89

Open danielmarchan3 opened 3 months ago

danielmarchan3 commented 3 months ago

Selection_015

azazellochg commented 1 month ago

@JorMaister I will need your help to understand what's going on. The problem is in the convert step.

ts = self.getTsFromTsId(tsId)
print(ts.hasAlignment())

gives False, while

for ts in self._getSetOfTiltSeries():
    print(ts.hasAlignment())

gives True

JorMaister commented 1 month ago

Hi, @azazellochg, I'll go tomorrow into it and check, but it seems weird at first sight.

JorMaister commented 4 weeks ago

Hi, @azazellochg,

They should behave the same, as:

def getTsFromTsId(self, tsId):
    tsSet = self._getSetOfTiltSeries()
    return tsSet.getItem(TiltSeries.TS_ID_FIELD, tsId)

and

def _getSetOfTiltSeries(self) -> SetOfTiltSeries: return self.inputSetOfTiltSeries.get()

Are both code fragments you pasted from the same code state of em-tomo and aretomo? Under this context, the only thing that comes to my mind is the difference between what's considered by hasAligment method and what was considered (something like being None or not being None but being the Identity matrix...)

@danielmarchan3, are in production or in devel mode? Maybe your code is not up to date.

azazellochg commented 4 weeks ago

Hi Jorge, it's very easy to reproduce, you can run imod fid alignment followed by aretomo with reconstruct only - it will fail because hasAlignment returns False

On Tue, 8 Oct 2024, 09:58 Jorge Jiménez de la Morena, < @.***> wrote:

Hi, @azazellochg https://github.com/azazellochg,

They should behave the same, as:

def getTsFromTsId(self, tsId): tsSet = self._getSetOfTiltSeries() return tsSet.getItem(TiltSeries.TS_ID_FIELD, tsId)

and

def _getSetOfTiltSeries(self) -> SetOfTiltSeries: return self.inputSetOfTiltSeries.get()

Are both code fragments you pasted from the same code state of em-tomo and aretomo? Under this context, the only thing that comes to my mind is the difference between what's considered by hasAligment method and what was considered (something like being None or not being None but being the Identity matrix...)

@danielmarchan3 https://github.com/danielmarchan3, are in production or in devel mode? Maybe your code is not up to date.

— Reply to this email directly, view it on GitHub https://github.com/scipion-em/scipion-em-aretomo/issues/89#issuecomment-2399267022, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBPJT2EGR4WBLCKZIPRYLZ2ONE5AVCNFSM6AAAAABLMH6L6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJZGI3DOMBSGI . You are receiving this because you were mentioned.Message ID: @.***>

JorMaister commented 4 weeks ago

Hi, @azazellochg, I've observed that the code line.

tsSet.getItem(TiltSeries.TS_ID_FIELD, tsId)

generates the desired ts, with all the attributes as expected (including the alignment as 2D), except the attribute _hasAlignment, which is updated from True to False. Any ideas, @pconesa?

JorMaister commented 3 weeks ago

Hi, @azazellochg. I have news about this. @pconesa and I have been looking into it:

Regarding the hasAlignment True/False bad behavior reported, it was because of a clone method calling when accessing the stored objects via key-value pair (what we want from now, concretely tsId --> set.getItem('_tsId', val)) instead of by objId set[objId]. That is implicitly the difference when aretomo retrieves each ts via the method getTsFromTsId. That clone included some ignored attributes by default. This will no longer be true (a PR is coming to em-tomo with those changes).

Solved that, I found that, at least aretomo2-1.1.3 can't reconstruct without having aligned the TS before... unless it finds an .aln file. It seems to be contradictory with the doc contents, but in practice, it is how it behaves:

loads the images and then it says Error: tilt angles cannot be found.

gives the same error.

So, I'd like to know what you think about it. In my case, I suggest removing all AreTomo versions except aretomo2-1.1.3 and focusing on it. It's quite exhausting having to check all the 4 versions we offer (1.3.4, 2-1.0.0, 2-1.1.2, 2-1.1.3) for each change we do, and if the behavior changes from one to another each time.

I can do the conversion from sqlite to aln if we decide to proceed that way.

azazellochg commented 3 weeks ago

Hi @JorMaister I'm glad you got to the bottom of it. I will check reconstruction without alignment next weekend