Skip to content

Commit

Permalink
updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilax committed Oct 27, 2023
1 parent 44e29e1 commit dbcf749
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions xmipptomo/protocols/protocol_cltomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from xmipp3 import Plugin
from pwem.protocols import EMProtocol
from tomo.protocols import ProtTomoBase
from tomo.objects import SetOfSubTomograms
from xmipp3.convert import readSetOfVolumes, readSetOfClassesVol, writeSetOfVolumes


Expand All @@ -44,29 +45,29 @@ class XmippProtCLTomo(EMProtocol, ProtTomoBase):
# --------------------------- DEFINE param functions --------------------------------------------
def _defineParams(self, form):
form.addSection(label='General parameters')
form.addParam('inputVolumes', PointerParam, pointerClass="SetOfVolumes", label='Set of volumes',
help="Set of volumes to align")
form.addParam('inputVolumes', PointerParam, pointerClass="SetOfSubTomograms", label='Subtomograms',
help="Set of subtomograms to align")
form.addParam('numberOfReferences', IntParam, label='Number of references', default=3,
help="How many references are computed at the end of the process")
form.addParam('numberOfIterations', IntParam, label='Number of iterations', default=15,
expertLevel=LEVEL_ADVANCED, help="How many iterations at each of the Clustering levels")
form.addParam('generateAligned', BooleanParam, default=True, label='Generate aligned subvolumes',
form.addParam('generateAligned', BooleanParam, default=True, label='Generate aligned subtomograms',
help="If set to true, it will be created a new set of volumes with all of them aligned")
form.addParam('align', BooleanParam, default=True, label="Align",
help="Do not align if volumes are already aligned, only classify")
help="Do not align if subtomograms are already aligned, only classify")

form.addSection(label='Initial references')
form.addParam('doGenerateInitial', BooleanParam, default=True, label='Generate initial volume',
help="Let CLTomo to automatically generate the initial references")
form.addParam('numberOfReferences0', IntParam, label='Number of initial references', default=1,
condition="doGenerateInitial",
help="How many initial volumes. If set to 1, all subvolumes are aligned to a single reference, " \
help="How many initial subtomograms. If set to 1, all subtomograms are aligned to a single reference, " \
"and then they are classified")
form.addParam('randomizeOrientation', BooleanParam, default=False, label='Randomize orientation',
condition="doGenerateInitial",
help="Use this option if all the input volumes have the same missing wedge or if they have not been previously aligned.")
form.addParam('referenceList', PointerParam, pointerClass="SetOfVolumes", label='Set of initial volumes',
condition="not doGenerateInitial", help="Set of initial volumes")
help="Use this option if all the input subtomograms have the same missing wedge or if they have not been previously aligned.")
form.addParam('referenceList', PointerParam, pointerClass="SetOfVolumes", label='Set of initial subtomograms',
condition="not doGenerateInitial", help="Set of initial subtomograms")

form.addSection(label='Constraints')
form.addParam('symmetry', StringParam, default='c1', label='Symmetry group',
Expand Down Expand Up @@ -156,27 +157,27 @@ def _summary(self):
if self.doGenerateInitial.get():
messages.append('Number of initial references: %d' % self.numberOfReferences0.get())
if self.randomizeOrientation.get():
messages.append('Input subvolume orientations were randomized')
messages.append('Input subtomograms orientations were randomized')
if not self.align:
messages.append('Input subvolumes were assumed to be already aligned')
messages.append('Input subtomograms were assumed to be already aligned')
messages.append('Number of output references: %d' % self.numberOfReferences.get())
return messages

def _validate(self):
errors = []
(Xdim1, Ydim1, Zdim1) = self.inputVolumes.get().getDimensions()
if Xdim1 != Ydim1 or Ydim1 != Zdim1:
errors.append("Input subvolumes are not cubic")
errors.append("Input subtomograms are not cubic")
N0 = -1
if not self.doGenerateInitial.get():
if not self.referenceList.hasValue():
errors.append("If references are not self generated, you have to provide a reference set of volumes")
else:
(Xdim2, Ydim2, Zdim2) = self.referenceList.get().getDimensions()
if Xdim2 != Ydim2 or Ydim2 != Zdim2:
errors.append("Reference subvolumes are not cubic")
errors.append("Reference subtomograms are not cubic")
if Xdim1 != Xdim2:
errors.append("Input and reference subvolumes are of different size")
errors.append("Input and reference subtomograms are of different size")
else:
N0 = self.numberOfReferences0.get()
if N0 > 0 and N0 > self.numberOfReferences.get():
Expand Down

0 comments on commit dbcf749

Please sign in to comment.