Skip to content

Commit

Permalink
fix crash in local split
Browse files Browse the repository at this point in the history
  • Loading branch information
tingzhao committed Jun 16, 2015
1 parent 95debe4 commit 85f56e4
Show file tree
Hide file tree
Showing 28 changed files with 389 additions and 57 deletions.
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ shift

edition=general
debug_config=release
while getopts d:e:c:q: option
make_args='-j3'
while getopts d:e:c:q:m: option
do
echo $option
echo $OPTARG
Expand All @@ -31,6 +32,8 @@ do
debug_config=$OPTARG;;
q)
ext_qmake_args=$OPTARG;;
m)
make_args=$OPTARG;;
esac
done

Expand Down
8 changes: 4 additions & 4 deletions build_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ cd ..
echo 'Building libneurolabi ...'
./update_library

if [ ! -d build ]
if [ ! -d build_debug ]
then
mkdir build
mkdir build_debug
fi

cd build
cd build_debug
$QMAKE -spec $QMAKE_SPEC CONFIG+=debug CONFIG+=x86_64 -o Makefile ../gui/gui.pro
make
make -j3
12 changes: 6 additions & 6 deletions neurolabi/gui/dvid/zdvidurl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,22 +304,22 @@ std::string ZDvidUrl::getKeyRangeUrl(
*/
}

std::string ZDvidUrl::getAnnotationUrl(const std::string &bodyLabelName) const
std::string ZDvidUrl::getBodyAnnotationUrl(const std::string &bodyLabelName) const
{
return getDataUrl(ZDvidData::GetName(ZDvidData::ROLE_BODY_ANNOTATION,
ZDvidData::ROLE_BODY_LABEL,
bodyLabelName));
}

std::string ZDvidUrl::getAnnotationUrl(uint64_t bodyId, const std::string &bodyLabelName) const
std::string ZDvidUrl::getBodyAnnotationUrl(uint64_t bodyId, const std::string &bodyLabelName) const
{
return GetKeyCommandUrl(getAnnotationUrl(bodyLabelName)) + "/" +
return GetKeyCommandUrl(getBodyAnnotationUrl(bodyLabelName)) + "/" +
ZString::num2str(bodyId);
}

std::string ZDvidUrl::getAnnotationUrl(uint64_t bodyId) const
std::string ZDvidUrl::getBodyAnnotationUrl(uint64_t bodyId) const
{
return getAnnotationUrl(bodyId, m_dvidTarget.getBodyLabelName());
return getBodyAnnotationUrl(bodyId, m_dvidTarget.getBodyLabelName());
}

std::string ZDvidUrl::getBodyInfoUrl(const std::string &bodyLabelName) const
Expand Down Expand Up @@ -405,7 +405,7 @@ std::string ZDvidUrl::getSynapseListUrl() const

std::string ZDvidUrl::getSynapseAnnotationUrl(const std::string &name) const
{
return GetKeyCommandUrl(getAnnotationUrl(m_dvidTarget.getBodyLabelName())) +
return GetKeyCommandUrl(getBodyAnnotationUrl(m_dvidTarget.getBodyLabelName())) +
"/" + name;
}

Expand Down
7 changes: 3 additions & 4 deletions neurolabi/gui/dvid/zdvidurl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class ZDvidUrl
const std::string &key1, const std::string &key2) const;
std::string getAllKeyUrl(const std::string &name) const;

std::string getAnnotationUrl(const std::string &bodyLabelName) const;
std::string getAnnotationUrl(
std::string getBodyAnnotationUrl(const std::string &bodyLabelName) const;
std::string getBodyAnnotationUrl(
uint64_t bodyId, const std::string &bodyLabelName) const;
std::string getAnnotationUrl(uint64_t bodyId) const;
std::string getBodyAnnotationUrl(uint64_t bodyId) const;

std::string getBodyInfoUrl(const std::string &dataName) const;
std::string getBodyInfoUrl(uint64_t bodyId, const std::string &dataName) const;
Expand All @@ -92,7 +92,6 @@ class ZDvidUrl
std::string getBoundBoxUrl() const;
std::string getBoundBoxUrl(int z) const;


std::string getLocalBodyIdUrl(int x, int y, int z) const;

std::string getBodyLabelUrl() const;
Expand Down
9 changes: 7 additions & 2 deletions neurolabi/gui/dvid/zdvidwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void ZDvidWriter::writeThumbnail(int bodyId, Stack *stack)
}
}

void ZDvidWriter::writeAnnotation(int bodyId, const ZJsonObject &obj)
void ZDvidWriter::writeAnnotation(uint64_t bodyId, const ZJsonObject &obj)
{
if (bodyId > 0 && !obj.isEmpty()) {
//ZString annotationString = obj.dumpString(0);
Expand All @@ -143,7 +143,7 @@ void ZDvidWriter::writeAnnotation(int bodyId, const ZJsonObject &obj)
QString command = QString(
"curl -g -X POST -H \"Content-Type: application/json\" "
"-d \"%1\" %2").arg(getJsonStringForCurl(obj).c_str()).
arg(ZDvidUrl(m_dvidTarget).getAnnotationUrl(
arg(ZDvidUrl(m_dvidTarget).getBodyAnnotationUrl(
bodyId, m_dvidTarget.getBodyLabelName()).c_str());

qDebug() << command;
Expand All @@ -157,6 +157,11 @@ void ZDvidWriter::writeAnnotation(const ZFlyEmNeuron &neuron)
writeAnnotation(neuron.getId(), neuron.getAnnotationJson());
}

void ZDvidWriter::writeBodyAnntation(const ZFlyEmBodyAnnotation &annotation)
{
writeAnnotation(annotation.getBodyId(), annotation.toJsonObject());
}

void ZDvidWriter::writeBodyInfo(int bodyId, const ZJsonObject &obj)
{
if (bodyId > 0 && !obj.isEmpty()) {
Expand Down
6 changes: 5 additions & 1 deletion neurolabi/gui/dvid/zdvidwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "zsparsestack.h"
#include "dvid/zdvidtarget.h"
#include "dvid/zdvidwriter.h"
#include "zflyembodyannotation.h"

class ZFlyEmNeuron;
class ZClosedCurve;
Expand All @@ -36,8 +37,11 @@ class ZDvidWriter : public QObject
void writeSwc(int bodyId, ZSwcTree *tree);
void writeThumbnail(int bodyId, ZStack *stack);
void writeThumbnail(int bodyId, Stack *stack);
void writeAnnotation(int bodyId, const ZJsonObject &obj);
void writeAnnotation(uint64_t bodyId, const ZJsonObject &obj);
void writeAnnotation(const ZFlyEmNeuron &neuron);

void writeBodyAnntation(const ZFlyEmBodyAnnotation &annotation);

void writeRoiCurve(const ZClosedCurve &curve, const std::string &key);
void deleteRoiCurve(const std::string &key);
void writeJsonString(const std::string &dataName, const std::string &key,
Expand Down
11 changes: 11 additions & 0 deletions neurolabi/gui/flyem/zflyembodyannotationbundle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "zflyembodyannotationbundle.h"

ZFlyEmBodyAnnotationBundle::ZFlyEmBodyAnnotationBundle()
{
}

void ZFlyEmBodyAnnotationBundle::addBodyAnnotation(
const ZFlyEmBodyAnnotation &annotation)
{
m_annotationArray.push_back(annotation);
}
21 changes: 21 additions & 0 deletions neurolabi/gui/flyem/zflyembodyannotationbundle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef ZFLYEMBODYANNOTATIONBUNDLE_H
#define ZFLYEMBODYANNOTATIONBUNDLE_H

#include <vector>
#include "zflyembodyannotation.h"

class ZFlyEmBodyAnnotationBundle
{
public:
ZFlyEmBodyAnnotationBundle();

void addBodyAnnotation(const ZFlyEmBodyAnnotation &annotation);

private:
std::vector<ZFlyEmBodyAnnotation> m_annotationArray;
std::string m_userName;
std::string m_software;
std::string m_description;
};

#endif // ZFLYEMBODYANNOTATIONBUNDLE_H
65 changes: 65 additions & 0 deletions neurolabi/gui/flyem/zflyembodyannotationdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "zflyembodyannotationdialog.h"
#include "ui_zflyembodyannotationdialog.h"
#include "zflyembodyannotation.h"

ZFlyEmBodyAnnotationDialog::ZFlyEmBodyAnnotationDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ZFlyEmBodyAnnotationDialog)
{
ui->setupUi(this);
}

ZFlyEmBodyAnnotationDialog::~ZFlyEmBodyAnnotationDialog()
{
delete ui;
}

void ZFlyEmBodyAnnotationDialog::setBodyId(uint64_t bodyId)
{
m_bodyId = bodyId;
}

QString ZFlyEmBodyAnnotationDialog::getComment() const
{
if (ui->orphanCheckBox->isChecked()) {
return "Orphan";
}

return "";
}

QString ZFlyEmBodyAnnotationDialog::getStatus() const
{
if (ui->skipCheckBox->isChecked()) {
return "Skip";
}

return "";
}

QString ZFlyEmBodyAnnotationDialog::getName() const
{
return ui->nameLineEdit->text();
}

QString ZFlyEmBodyAnnotationDialog::getType() const
{
return "";
}

uint64_t ZFlyEmBodyAnnotationDialog::getBodyId() const
{
return m_bodyId;
}

ZFlyEmBodyAnnotation ZFlyEmBodyAnnotationDialog::getBodyAnnotation() const
{
ZFlyEmBodyAnnotation annotation;
annotation.setBodyId(getBodyId());
annotation.setComment(getComment().toStdString());
annotation.setStatus(getStatus().toStdString());
annotation.setName(getName().toStdString());
annotation.setType(getType().toStdString());

return annotation;
}
35 changes: 35 additions & 0 deletions neurolabi/gui/flyem/zflyembodyannotationdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef ZFLYEMBODYANNOTATIONDIALOG_H
#define ZFLYEMBODYANNOTATIONDIALOG_H

#include <QDialog>

class ZFlyEmBodyAnnotation;

namespace Ui {
class ZFlyEmBodyAnnotationDialog;
}

class ZFlyEmBodyAnnotationDialog : public QDialog
{
Q_OBJECT

public:
explicit ZFlyEmBodyAnnotationDialog(QWidget *parent = 0);
~ZFlyEmBodyAnnotationDialog();

ZFlyEmBodyAnnotation getBodyAnnotation() const;

void setBodyId(uint64_t bodyId);

uint64_t getBodyId() const;
QString getComment() const;
QString getName() const;
QString getType() const;
QString getStatus() const;

private:
Ui::ZFlyEmBodyAnnotationDialog *ui;
uint64_t m_bodyId;
};

#endif // ZFLYEMBODYANNOTATIONDIALOG_H
103 changes: 103 additions & 0 deletions neurolabi/gui/flyem/zflyembodyannotationdialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ZFlyEmBodyAnnotationDialog</class>
<widget class="QDialog" name="ZFlyEmBodyAnnotationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>265</width>
<height>181</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="bodyIdLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="nameLineEdit"/>
</item>
<item>
<widget class="QComboBox" name="nameComboBox"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="orphanCheckBox">
<property name="text">
<string>Orphan</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="skipCheckBox">
<property name="text">
<string>Skip</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ZFlyEmBodyAnnotationDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ZFlyEmBodyAnnotationDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading

0 comments on commit 85f56e4

Please sign in to comment.