48 unsigned pos = this->indexOf(uid);
49 if (pos != mLayouts.size())
58 unsigned pos = this->indexOf(uid);
59 if (pos != mLayouts.size())
67 std::vector<QString> retval;
68 for (
unsigned i = 0; i < mLayouts.size(); ++i)
70 retval.push_back(mLayouts[i].getUid());
77 unsigned pos = this->indexOf(data.
getUid());
78 if (pos == mLayouts.size())
79 mLayouts.push_back(data);
89 for (LayoutDataVector::const_iterator iter = mLayouts.begin(); iter != mLayouts.end(); ++iter)
92 count = iter->getUid().toInt() + 1;
99 mLayouts.erase(mLayouts.begin() + indexOf(uid));
103 unsigned LayoutRepository::indexOf(
const QString uid)
const
105 for (
unsigned i = 0; i < mLayouts.size(); ++i)
107 if (mLayouts[i].getUid() == uid)
110 return mLayouts.size();
115 bool isLayout =
false;
116 for (
unsigned i = 0; i < mLayouts.size(); ++i)
118 if (uid == mLayouts[i].getUid())
125 bool isDefaultLayout = std::count(mDefaultLayouts.begin(), mDefaultLayouts.end(), uid);
128 if (isLayout && !isDefaultLayout)
139 this->blockSignals(
true);
141 QDomElement layouts = file.
getElement(
"layouts");
142 QDomNode layout = layouts.firstChild();
143 for (; !layout.isNull(); layout = layout.nextSibling())
145 if (layout.toElement().tagName() !=
"layout")
157 this->blockSignals(
false);
159 for (
unsigned i=0; i<custom.size(); ++i)
167 for (LayoutDataVector::iterator iter = mLayouts.begin(); iter != mLayouts.end(); ++iter)
169 if (!this->
isCustom(iter->getUid()))
172 QDomElement layoutNode = file.
getDocument().createElement(
"layout");
173 layoutsNode.
getElement().appendChild(layoutNode);
174 iter->addXml(layoutNode);
181 void LayoutRepository::addDefaults()
183 mDefaultLayouts.clear();
225 layout.setView(1,
ptAXIAL, LayoutRegion(0, 3));
226 layout.setView(1,
ptCORONAL, LayoutRegion(1, 3));
227 layout.setView(1,
ptSAGITTAL, LayoutRegion(2, 3));
233 layout.setView(1,
ptAXIAL, LayoutRegion(0, 0, 3, 3));
235 layout.setView(1,
ptCORONAL, LayoutRegion(1, 3));
236 layout.setView(1,
ptSAGITTAL, LayoutRegion(2, 3));
244 layout.setView(2,
ptAXIAL, LayoutRegion(1, 3, 1, 2));
245 layout.setView(2,
ptCORONAL, LayoutRegion(2, 3, 1, 2));
252 layout.setView(1,
ptANYPLANE, LayoutRegion(0, 3));
253 layout.setView(1,
ptSIDEPLANE, LayoutRegion(1, 3));
258 LayoutData layout =
LayoutData::create(
"LAYOUT_3D_ACS_SINGLE",
"3D ACS Connected", 3, 4);
260 layout.setView(0,
ptAXIAL, LayoutRegion(0, 3));
261 layout.setView(0,
ptCORONAL, LayoutRegion(1, 3));
262 layout.setView(0,
ptSAGITTAL, LayoutRegion(2, 3));
267 LayoutData layout =
LayoutData::create(
"LAYOUT_3D_AD_SINGLE",
"3D AnyDual Connected", 2, 4);
269 layout.setView(0,
ptANYPLANE, LayoutRegion(0, 3));
270 layout.setView(0,
ptSIDEPLANE, LayoutRegion(1, 3));
279 LayoutData layout =
LayoutData::create(
"LAYOUT_OBLIQUE_3DAnyDual_x1",
"3D Any Dual x1", 1, 3);
281 layout.setView(1,
ptANYPLANE, LayoutRegion(0, 1));
282 layout.setView(1,
ptSIDEPLANE, LayoutRegion(0, 2));
286 LayoutData layout =
LayoutData::create(
"LAYOUT_OBLIQUE_3DAnyDual_x2",
"3D Any Dual x2", 2, 3);
288 layout.setView(1,
ptANYPLANE, LayoutRegion(0, 1));
289 layout.setView(1,
ptSIDEPLANE, LayoutRegion(1, 1));
290 layout.setView(2,
ptANYPLANE, LayoutRegion(0, 2));
291 layout.setView(2,
ptSIDEPLANE, LayoutRegion(1, 2));
295 LayoutData layout =
LayoutData::create(
"LAYOUT_OBLIQUE_AnyDual_x3",
"Any Dual x3", 2, 3);
296 layout.setView(0,
ptANYPLANE, LayoutRegion(0, 0));
297 layout.setView(0,
ptSIDEPLANE, LayoutRegion(1, 0));
298 layout.setView(1,
ptANYPLANE, LayoutRegion(0, 1));
299 layout.setView(1,
ptSIDEPLANE, LayoutRegion(1, 1));
300 layout.setView(2,
ptANYPLANE, LayoutRegion(0, 2));
301 layout.setView(2,
ptSIDEPLANE, LayoutRegion(1, 2));
310 LayoutData layout =
LayoutData::create(
"LAYOUT_ORTHOGONAL_3DACS_x1",
"3D ACS x1", 2, 2);
312 layout.setView(1,
ptAXIAL, LayoutRegion(0, 1));
313 layout.setView(1,
ptCORONAL, LayoutRegion(1, 0));
314 layout.setView(1,
ptSAGITTAL, LayoutRegion(1, 1));
318 LayoutData layout =
LayoutData::create(
"LAYOUT_ORTHOGONAL_3DACS_x2",
"3D ACS x2", 3, 3);
320 layout.setView(1,
ptAXIAL, LayoutRegion(0, 1));
321 layout.setView(1,
ptCORONAL, LayoutRegion(1, 1));
322 layout.setView(1,
ptSAGITTAL, LayoutRegion(2, 1));
323 layout.setView(2,
ptAXIAL, LayoutRegion(0, 2));
324 layout.setView(2,
ptCORONAL, LayoutRegion(1, 2));
325 layout.setView(2,
ptSAGITTAL, LayoutRegion(2, 2));
330 layout.setView(0,
ptAXIAL, LayoutRegion(0, 0));
331 layout.setView(0,
ptCORONAL, LayoutRegion(1, 0));
332 layout.setView(0,
ptSAGITTAL, LayoutRegion(2, 0));
333 layout.setView(1,
ptAXIAL, LayoutRegion(0, 1));
334 layout.setView(1,
ptCORONAL, LayoutRegion(1, 1));
335 layout.setView(1,
ptSAGITTAL, LayoutRegion(2, 1));
336 layout.setView(2,
ptAXIAL, LayoutRegion(0, 2));
337 layout.setView(2,
ptCORONAL, LayoutRegion(1, 2));
338 layout.setView(2,
ptSAGITTAL, LayoutRegion(2, 2));
352 LayoutData layout =
LayoutData::create(
"LAYOUT_US_Acquisition",
"US Acquisition", 2, 3);
353 layout.setView(0,
ptANYPLANE, LayoutRegion(1, 2, 1, 1));
362 mDefaultLayouts.push_back(data.
getUid());
363 mLayouts.push_back(data);
QString qstring_cast(const T &val)
void insert(const LayoutData &data)
ptCORONAL
a slice seen from the front of the patient
static LayoutData createHeader(QString uid, QString name)
bool exists(const QString uid) const
ptAXIAL
a slice seen from the top of the patient
QDomElement getElement()
return the current element
ptSAGITTAL
a slice seen from the side of the patient
LayoutData get(const QString uid) const
bool isCustom(const QString &uid) const
void layoutChanged(QString uid)
void setView(int group, PLANE_TYPE type, LayoutRegion region)
void parseXml(QDomNode node)
load state from xml
void save(XmlOptionFile file)
QDomDocument getDocument()
returns the document
void load(XmlOptionFile file)
void erase(const QString uid)
void removeChildren()
remove all child nodes of the current element.
ptANYPLANE
a plane aligned with the tool base plane
std::vector< QString > getAvailable() const
static LayoutData create(QString uid, QString name, int rows, int cols)
Helper class for xml files used to store ssc/cx data.
void addDefault(LayoutData data)
ptSIDEPLANE
z-rotated 90* relative to anyplane (dual anyplane)
XmlOptionFile descend(QString element) const
step one level down in the xml tree
QString generateUid() const