void neuron_tipspicker_dialog::locate_tip() { checkwindow(); checkStatus(); if(!check_syncTriView->isChecked()) return; if(cb_tips->count()==0) return; if(!v3dwin) return; int mid=cb_tips->currentIndex(); v3dhandleList list_triwin = callback->getImageWindowList(); for(V3DLONG i=0; i<list_triwin.size(); i++){ // //for test // qDebug()<<"cojoc1:"<<callback->getImageName(list_triwin.at(i)); // qDebug()<<"cojoc2:"<<callback->getImageName(v3dwin); if(callback->getImageName(v3dwin).contains(callback->getImageName(list_triwin.at(i)))){ TriviewControl * p_control = callback->getTriviewControl(list_triwin.at(i)); p_control->setFocusLocation((long)mList->at(mid).x,(long)mList->at(mid).y,(long)mList->at(mid).z); } } }
void neuron_tipspicker_dialog::change_tip(int c) { checkwindow(); checkStatus(); int info[4]; if(curIdx<mList->size()) { get_marker_info(mList->at(curIdx),info); int color[3]={0}; if(info[2]==1) color[1]=255; else if(info[2]==2) color[0]=255; else color[2]=255; update_marker_info(mList->at(curIdx),info,color); } if(cb_tips->count()>0) { int color[3]={255,0,255}; int i=cb_tips->currentIndex(); get_marker_info(mList->at(i),info); update_marker_info(mList->at(i),info,color); curIdx=i; } //for test qDebug()<<"===========UPDATE MARKER============ change tip"; updatemarker(); }
void color_render_ESWC_dialog::set_span() { checkwindow(); int feaId=cb_feature->currentIndex(); float lower=nt->listNeuron.at(0).fea_val.at(feaId); float upper=nt->listNeuron.at(0).fea_val.at(feaId); for(V3DLONG nid=0; nid<nt->listNeuron.size(); nid++){ lower=MIN(lower, nt->listNeuron.at(nid).fea_val.at(feaId)); upper=MAX(upper, nt->listNeuron.at(nid).fea_val.at(feaId)); } spin_max->setMinimum(lower); spin_max->setMaximum(255); spin_min->setMinimum(0); spin_min->setMaximum(upper); spin_max->setValue(upper); spin_min->setValue(lower); spin_black->setMinimum(lower); spin_black->setMaximum(upper); spin_white->setMinimum(lower); spin_white->setMaximum(upper); spin_meg->setMinimum(lower); spin_meg->setMaximum(upper); }
void neuron_tipspicker_dialog::update_tip() { checkwindow(); link_new_marker_neuron(); //populate tips cb_tips->clear(); int info[4]; for(int i=0; i<mList->size(); i++){ if(get_marker_info(mList->at(i),info)){ if(info[2]==1) cb_tips->addItem("Marker: " + QString::number(i+1) + " accepted"); else if(info[2]==2) cb_tips->addItem("Marker: " + QString::number(i+1) + " rejected"); else cb_tips->addItem("Marker: " + QString::number(i+1)); } } if(curIdx>=cb_tips->count()) curIdx=0; checkStatus(); }
void neuron_tipspicker_dialog::reset_tip() { checkwindow(); //link marker neuron relink_marker_neuron(); //populate tips cb_tips->clear(); int info[4]; for(int i=0; i<mList->size(); i++){ if(get_marker_info(mList->at(i),info)){ if(info[2]==1) cb_tips->addItem("Marker: " + QString::number(i+1) + " accepted"); else if(info[2]==2) cb_tips->addItem("Marker: " + QString::number(i+1) + " rejected" ); else cb_tips->addItem("Marker: " + QString::number(i+1)); } } curIdx=0; checkStatus(); //for test qDebug()<<"===========UPDATE MARKER============ reset tip"; updatemarker(); }
void neuron_tipspicker_dialog::skip_tip() { checkwindow(); checkStatus(); int i=cb_tips->currentIndex(); if(i+1<cb_tips->count()){ cb_tips->setCurrentIndex(i+1); } }
void NeuronXYTileDialog::slot_reset() { checkwindow(); reset(); if(v3dwin){ callback->update_NeuronBoundingBox(v3dwin); callback->update_3DViewer(v3dwin); } }
void neuron_tipspicker_dialog::updatemarker() { checkwindow(); if(v3dcontrol){ v3dcontrol->updateLandmark(); } locate_tip(); roi_tip(); }
void color_render_ESWC_dialog::reject() { checkwindow(); reset(); if(v3dwin){ callback->update_3DViewer(v3dwin); } QDialog::reject(); }
void color_render_ESWC_dialog::reset() { checkwindow(); for(V3DLONG i=0; i<bk_type.size(); i++){ nt->listNeuron[i].type=bk_type.at(i); } if(v3dwin){ callback->update_3DViewer(v3dwin); } }
void neuron_tipspicker_dialog::save() { checkwindow(); QString fileSaveName = QFileDialog::getSaveFileName(0, QObject::tr("Save File"), QObject::tr(""), QObject::tr("Supported file (*.marker)" ";;Marker (*.marker)" )); if(!fileSaveName.isEmpty()){ output_markers(fileSaveName); } }
void neuron_tipspicker_dialog::spineCheck(int c) { checkwindow(); if(check_spine->isChecked()){ spin_spineLen->setEnabled(true); spin_spineAng->setEnabled(true); spin_spineRadius->setEnabled(true); }else{ spin_spineLen->setEnabled(false); spin_spineAng->setEnabled(false); spin_spineRadius->setEnabled(false); } }
static int SetWindowAttrib(lua_State *L) { win_t *win = checkwindow(L, 1); int attrib = checktarget(L, 2); switch(attrib) { case GLFW_RESIZABLE: case GLFW_DECORATED: case GLFW_FLOATING: case GLFW_AUTO_ICONIFY: case GLFW_FOCUS_ON_SHOW: return SetBoolean(L, win->window, attrib); default: return luaL_error(L, "invalid attribute '%s'", lua_tostring(L, 2)); } return 0; }
void neuron_tipspicker_dialog::search() { checkwindow(); mList->clear(); int dir=cb_dir->currentIndex(); int side=cb_side->currentIndex(); double zscale=spin_zscale->value(); double span=spin_searchspan->value(); double gapThr=spin_gapthr->value(); double angThr=cos(spin_angthr->value()/180*M_PI); double segmentThr=spin_segthr->value(); double spineLengthThr = 0; double spineRadiusThr = 0; double spineAngThr = 1; if(check_spine->isChecked()){ spineLengthThr = spin_spineLen->value(); spineAngThr = cos(spin_spineAng->value()/180*M_PI); spineRadiusThr = spin_spineRadius->value(); } QList<Candidate> cands; searchBorderTips(ntList, cands, side, dir, zscale, span, gapThr, angThr, segmentThr, spineLengthThr, spineAngThr, spineRadiusThr); qDebug()<<"found "<<cands.size()<<" border tips"; for(int i=0; i<cands.size(); i++){ V3DLONG nid=cands.at(i).nid; V3DLONG pid=cands.at(i).pid; LocationSimple S0 = LocationSimple(ntList->at(nid).listNeuron[pid].x, ntList->at(nid).listNeuron[pid].y, ntList->at(nid).listNeuron[pid].z); S0.color.r = 0; S0.color.g = 0; S0.color.b = 255; S0.name = QString::number(i+1).toStdString(); QString c0 = QString::number(nid)+" "+QString::number(pid)+" 0"; S0.comments = c0.toStdString(); mList->append(S0); } update_tip(); }
void neuron_tipspicker_dialog::reject_tip() { checkwindow(); checkStatus(); int info[4]; int color[3]={255,0,0}; int i=cb_tips->currentIndex(); get_marker_info(mList->at(i),info); info[2]=2; update_marker_info(mList->at(i),info,color); cb_tips->setItemText(i, "Marker: " + QString::number(i+1) + " rejected"); if(i+1<cb_tips->count()){ cb_tips->setCurrentIndex(i+1); }else{ //for test qDebug()<<"===========UPDATE MARKER============ reject tip"; updatemarker(); } }
void color_render_ESWC_dialog::update() { checkwindow(); float lower=spin_min->value(); float upper=spin_max->value(); float scale=upper-lower; int feaId=cb_feature->currentIndex(); int colormapId=cb_colormap->currentIndex(); for(V3DLONG nid=0; nid<nt->listNeuron.size(); nid++){ float tmp=0; if(nt->listNeuron.at(nid).fea_val.size()>feaId){ if(check_black->isChecked() && nt->listNeuron.at(nid).fea_val.at(feaId)<=spin_black->value()){ tmp=1; }else if(check_white->isChecked() && nt->listNeuron.at(nid).fea_val.at(feaId)<=spin_white->value()){ tmp=0; }else if(check_meg->isChecked() && nt->listNeuron.at(nid).fea_val.at(feaId)>=spin_meg->value()){ tmp=4; }else{ tmp=(nt->listNeuron.at(nid).fea_val.at(feaId)-lower)/scale; if(tmp<0) tmp=0; if(tmp>1) tmp=1; if (colormapId == 0 ){ tmp=tmp*255+300; //300-555 are reserved for heat colors }else{ tmp=tmp*235+20; // 0~20 are reserved for dendrite types, the real color range is from 20~255 (235 colors from blue to red) } } } nt->listNeuron[nid].type=tmp; } if(v3dwin){ callback->update_3DViewer(v3dwin); } }
static int GetWindowAttrib(lua_State *L) { win_t *win = checkwindow(L, 1); int attrib = checktarget(L, 2); switch(attrib) { case GLFW_FOCUSED: case GLFW_ICONIFIED: case GLFW_VISIBLE: case GLFW_RESIZABLE: case GLFW_DECORATED: case GLFW_FLOATING: case GLFW_MAXIMIZED: case GLFW_CENTER_CURSOR: case GLFW_TRANSPARENT_FRAMEBUFFER: case GLFW_HOVERED: case GLFW_FOCUS_ON_SHOW: case GLFW_SCALE_TO_MONITOR: return GetBoolean(L, win->window, attrib); case GLFW_CLIENT_API: GET_ENUM(L, win->window, attrib, pushapi); case GLFW_CONTEXT_CREATION_API: GET_ENUM(L, win->window, attrib, pushcontextcreationapi); case GLFW_CONTEXT_VERSION_MAJOR: case GLFW_CONTEXT_VERSION_MINOR: case GLFW_CONTEXT_REVISION: return GetInteger(L, win->window, attrib); case GLFW_OPENGL_FORWARD_COMPAT: case GLFW_OPENGL_DEBUG_CONTEXT: return GetBoolean(L, win->window, attrib); case GLFW_OPENGL_PROFILE: GET_ENUM(L, win->window, attrib, pushprofile); case GLFW_CONTEXT_ROBUSTNESS: GET_ENUM(L, win->window, attrib, pushrobustness); case GLFW_CONTEXT_RELEASE_BEHAVIOR: GET_ENUM(L, win->window, attrib, pushreleasebehavior); default: return luaL_error(L, "invalid attribute '%s'", lua_tostring(L, 2)); } return 0; }
void NeuronTileDisplayDialog::tile() { checkwindow(); reset(); { double move_x, move_y, move_z; cur_x = spin_x->value(); cur_y = spin_y->value(); cur_z = spin_z->value(); for(int i=1; i<ntList->size(); i++){ move_x = cur_x*i; move_y = cur_y*i; move_z = cur_z*i; NeuronTree* p = (NeuronTree*)&(ntList->at(i)); proc_neuron_add_offset(p, move_x, move_y, move_z); } } if(v3dwin){ callback->update_NeuronBoundingBox(v3dwin); callback->update_3DViewer(v3dwin); } }
void neuron_tipspicker_dialog::roi_tip() { checkwindow(); checkStatus(); int roiWinSize=spin_roisize->value(); if(!check_syncTriView->isChecked()) return; if(cb_tips->count()==0) return; if(!v3dwin) return; int mid=cb_tips->currentIndex(); v3dhandleList list_triwin = callback->getImageWindowList(); for(V3DLONG i=0; i<list_triwin.size(); i++){ if(callback->getImageName(v3dwin).contains(callback->getImageName(list_triwin.at(i)))){ //reset ROI ROIList pRoiList=callback->getROI(list_triwin.at(i)); for(int j=0;j<3;j++){ pRoiList[j].clear(); } pRoiList[0] << QPoint((long)mList->at(mid).x-roiWinSize,(long)mList->at(mid).y-roiWinSize); pRoiList[0] << QPoint((long)mList->at(mid).x+roiWinSize,(long)mList->at(mid).y-roiWinSize); pRoiList[0] << QPoint((long)mList->at(mid).x+roiWinSize,(long)mList->at(mid).y+roiWinSize); pRoiList[0] << QPoint((long)mList->at(mid).x-roiWinSize,(long)mList->at(mid).y+roiWinSize); pRoiList[1] << QPoint((long)mList->at(mid).z-roiWinSize,(long)mList->at(mid).y-roiWinSize); pRoiList[1] << QPoint((long)mList->at(mid).z+roiWinSize,(long)mList->at(mid).y-roiWinSize); pRoiList[1] << QPoint((long)mList->at(mid).z+roiWinSize,(long)mList->at(mid).y+roiWinSize); pRoiList[1] << QPoint((long)mList->at(mid).z-roiWinSize,(long)mList->at(mid).y+roiWinSize); pRoiList[2] << QPoint((long)mList->at(mid).x-roiWinSize,(long)mList->at(mid).z-roiWinSize); pRoiList[2] << QPoint((long)mList->at(mid).x+roiWinSize,(long)mList->at(mid).z-roiWinSize); pRoiList[2] << QPoint((long)mList->at(mid).x+roiWinSize,(long)mList->at(mid).z+roiWinSize); pRoiList[2] << QPoint((long)mList->at(mid).x-roiWinSize,(long)mList->at(mid).z+roiWinSize); if(callback->setROI(list_triwin.at(i),pRoiList)){ callback->updateImageWindow(list_triwin.at(i)); }else{ qDebug()<<"error: failed to set ROI"; return; } callback->closeROI3DWindow(list_triwin.at(i)); callback->openROI3DWindow(list_triwin.at(i)); QString fname_roiwin="Local 3D View [" + callback->getImageName(list_triwin.at(i)) +"]"; V3dR_MainWindow * mainwin_roi = 0; qDebug()<<"===========ROI============= searching: "<<fname_roiwin; QList <V3dR_MainWindow *> tmpwinlist = callback->getListAll3DViewers(); for(int j=0; j<tmpwinlist.size(); j++){ qDebug()<<"===========ROI============= "<<callback->getImageName(tmpwinlist[j]); if(callback->getImageName(tmpwinlist[j]).contains(fname_roiwin)){ mainwin_roi = tmpwinlist[j]; break; } } if(!mainwin_roi){ qDebug()<<"===========ROI============= failed open ROI window"; return; } qDebug()<<"===========ROI============= update ROI window with triview"; View3DControl * v3dlocalcontrol = callback->getLocalView3DControl(list_triwin.at(i)); v3dlocalcontrol->updateLandmark(); QList <NeuronTree> * p_nttmp = callback->getHandleNeuronTrees_Any3DViewer(mainwin_roi); if(p_nttmp->size()!=ntList->size()){ qDebug()<<"===========ROI============= copy neuron tree to 3Dview"; p_nttmp->clear(); for(int j=0; j<ntList->size(); j++){ p_nttmp->push_back((*ntList)[j]); } qDebug()<<"===========ROI============= copied neuron tree: "<<p_nttmp->size(); callback->update_NeuronBoundingBox(mainwin_roi); } callback->update_3DViewer(mainwin_roi); break; } } qDebug()<<"===========ROI============= done"; }
void color_render_ESWC_dialog::set_colormap() { checkwindow(); }
void color_render_ESWC_dialog::enterEvent(QEvent *e) { checkwindow(); QDialog::enterEvent(e); }
void NeuronXYTileDialog::tile() { checkwindow(); reset(); if(ntList->size()<=1) return; double dx=spin_x->value(); double dy=spin_y->value(); double rate=spin_ratial->value(); //search for the best Nx int Nt=ntList->size(), Nx; double bestRate=rate*1e16; //try all possible Nx for(int tmpNx=Nt; tmpNx>0; tmpNx--){ double xmin=ntList->at(0).listNeuron.at(0).x; double xmax=ntList->at(0).listNeuron.at(0).x; double ymin=ntList->at(0).listNeuron.at(0).y; double ymax=ntList->at(0).listNeuron.at(0).y; double move_x, move_y; int i=0; for(int y=0; y<Nt/tmpNx+1; y++){ for(int x=0; x<tmpNx; x++){ if(i>=ntList->size()) break; move_x = dx*x; move_y = dy*y; NeuronTree* p = (NeuronTree*)&(ntList->at(i)); for(int j=0; j<p->listNeuron.size(); j++){ xmin=MIN(xmin,p->listNeuron.at(j).x+x*dx); xmax=MAX(xmax,p->listNeuron.at(j).x+x*dx); ymin=MIN(ymin,p->listNeuron.at(j).y+y*dy); ymax=MAX(ymax,p->listNeuron.at(j).y+y*dy); } i++; } if(i>=ntList->size()) break; } double tmpRate=(xmax-xmin)/(ymax-ymin); if(fabs(bestRate/rate-1)>fabs(tmpRate/rate-1)){ bestRate=tmpRate; Nx=tmpNx; } } qDebug()<<"XY Tile Display: X direction number "<<Nx<<"; X/Y rate: "<<bestRate; { double move_x, move_y, move_z=0; int i=0; for(int y=0; y<Nt/Nx+1; y++){ for(int x=0; x<Nx; x++){ if(i>=ntList->size()) break; move_x = dx*x; move_y = dy*y; NeuronTree* p = (NeuronTree*)&(ntList->at(i)); proc_neuron_add_offset(p, move_x, move_y, move_z); cur_x.push_back(move_x); cur_y.push_back(move_y); //qDebug()<<"cojoc: "<<move_x<<":"<<move_y<<"\t"<<x<<":"<<y<<":"<<Nx; i++; } if(i>=ntList->size()) break; } } if(v3dwin){ callback->update_NeuronBoundingBox(v3dwin); callback->update_3DViewer(v3dwin); } }
void NeuronTileDisplayDialog::enterEvent(QEvent *e) { checkwindow(); QDialog::enterEvent(e); }