43 #include <QStringList>
51 using namespace FSLIB;
70 if(hemi == 0 || hemi == 1)
72 if(
Surface::read(subject_id, hemi, surf, subjects_dir, t_Surface))
77 if(
Surface::read(subject_id, 0, surf, subjects_dir, t_Surface))
79 if(
Surface::read(subject_id, 1, surf, subjects_dir, t_Surface))
92 if(hemi == 0 || hemi == 1)
113 if(p_LHSurface.
hemi() == 0)
114 m_qMapSurfs.insert(0, p_LHSurface);
116 qWarning(
"Left hemisphere id is not 0. LH surface not assigned!");
118 if(p_RHSurface.
hemi() == 1)
119 m_qMapSurfs.insert(1, p_RHSurface);
121 qWarning(
"Right hemisphere id is not 1. RH surface not assigned!");
133 *
this = t_SurfaceSet;
159 qint32 hemi = p_Surface.
hemi();
160 m_qMapSurfs.remove(hemi);
162 m_qMapSurfs.insert(hemi, p_Surface);
170 p_SurfaceSet.
clear();
172 QStringList t_qListFileName;
173 t_qListFileName << p_sLHFileName << p_sRHFileName;
175 for(qint32 i = 0; i < t_qListFileName.size(); ++i)
180 if(t_qListFileName[i].contains(
"lh."))
181 p_SurfaceSet.m_qMapSurfs.insert(0, t_Surface);
182 else if(t_qListFileName[i].contains(
"rh."))
183 p_SurfaceSet.m_qMapSurfs.insert(1, t_Surface);
189 p_SurfaceSet.calcOffset();
200 return m_qMapSurfs.find(idx).value();
202 return m_qMapSurfs.find(idx).value();
205 qWarning(
"Warning: Index is not '0' or '1'! Returning '0'.");
206 return m_qMapSurfs.find(0).value();
216 return m_qMapSurfs.find(idx).value();
218 return m_qMapSurfs.find(idx).value();
221 qWarning(
"Warning: Index is not '0' or '1'! Returning '0'.");
222 return m_qMapSurfs.find(0).value();
231 if(idt.compare(
"lh") == 0)
232 return m_qMapSurfs.find(0).value();
233 else if(idt.compare(
"rh") == 0)
234 return m_qMapSurfs.find(1).value();
237 qWarning(
"Warning: Identifier is not 'lh' or 'rh'! Returning 'lh'.");
238 return m_qMapSurfs.find(0).value();
247 if(idt.compare(
"lh") == 0)
248 return m_qMapSurfs.find(0).value();
249 else if(idt.compare(
"rh") == 0)
250 return m_qMapSurfs.find(1).value();
253 qWarning(
"Warning: Identifier is not 'lh' or 'rh'! Returning 'lh'.");
254 return m_qMapSurfs.find(0).value();
261 void SurfaceSet::calcOffset()
266 if(m_qMapSurfs.size() == 2 && QString::compare(m_qMapSurfs.begin().value().surf(),
"inflated") == 0)
268 float xOffset = m_qMapSurfs.find(0).value().rr().col(0).maxCoeff() - m_qMapSurfs.find(1).value().rr().col(0).minCoeff();
269 Vector3f vecLhOffset, vecRhOffset;
270 vecLhOffset << (xOffset/2.0f), 0, 0;
271 vecRhOffset << (-xOffset/2.0f), 0, 0;
272 m_qMapSurfs.find(0).value().offset() = vecLhOffset;
273 m_qMapSurfs.find(1).value().offset() = vecRhOffset;
const Surface & operator[](qint32 idx) const
SurfaceSet class declaration.
void insert(const Surface &p_Surface)
static bool read(const QString &p_sLHFileName, const QString &p_sRHFileName, SurfaceSet &p_SurfaceSet)
static bool read(const QString &subject_id, qint32 hemi, const QString &surf, const QString &subjects_dir, Surface &p_Surface, bool p_bLoadCurvature=true)
A hemisphere set of surfaces.