예제 #1
0
파일: __init__.py 프로젝트: xgrg/pluricent
 def study_id(self, study):
     from models import Study
     try:
         return self.session.query(
             Study.id).filter(Study.name == study).one()[0]
     except base.NoResultFound:
         raise base.NoResultFound('%s does not exist' % study)
예제 #2
0
파일: __init__.py 프로젝트: xgrg/pluricent
 def measurements(self, study=None, structure=None):
     if study and not study in self.studies():
         raise base.NoResultFound('%s not found in %s' %
                                  (study, self.studies()))
     if structure and not structure in [
             e.structure for e in self.measurements()
     ]:
         raise base.NoResultFound('%s not found in existing measurements' %
                                  structure)
     a = self.session.query(models.Measurement)
     if study:
         a = a.join(models.T1Image).join(
             models.Subject).filter(models.Study.name == study)
     if structure:
         a = a.filter(models.Measurement.structure == structure)
     return a.all()
예제 #3
0
파일: __init__.py 프로젝트: xgrg/pluricent
 def subject_id(self, study_name, identifier):
     from models import Subject
     try:
         return self.session.query(
             Subject.id).filter(Subject.identifier == identifier).filter(
                 models.Subject.study_id == self.study_id(
                     study_name)).one()[0]
     except base.NoResultFound:
         raise base.NoResultFound('%s not found in %s' %
                                  (identifier, study_name))
예제 #4
0
파일: __init__.py 프로젝트: xgrg/pluricent
 def processing(self, **kw):
     if 'study' in kw and not kw['study'] in self.studies():
         raise base.NoResultFound('%s not found in %s' %
                                  (kw['study'], self.studies()))
     a = self.session.query(models.Processing)
     if 'datatype' in kw:
         a = a.filter(models.Processing.datatype == kw['datatype'])
     if 'study' in kw:
         a = a.join(models.Subject).join(
             models.Study).filter(models.Study.name == kw['study'])
     if 'subject' in kw:
         a = a.join(models.Subject).filter(
             models.Subject.identifier == kw['subject'])
     return a.all()
예제 #5
0
파일: __init__.py 프로젝트: xgrg/pluricent
 def subject_from_id(self, id):
     from models import Subject
     try:
         return self.session.query(Subject).filter(Subject.id == id).one()
     except base.NoResultFound:
         raise base.NoResultFound('%s not found' % id)