diff --git a/ptx_meshmask.cc b/ptx_meshmask.cc index 2fd96ba852756a527d633796dff0a10f0cd4c9e9..1e853997c430df0fb761cd06c706296e6c7d79cc 100644 --- a/ptx_meshmask.cc +++ b/ptx_meshmask.cc @@ -4,7 +4,8 @@ #include "ptx_meshmask.h" #include "streamlines.h" - +#include "shapeModel/shapeModel.h" +using namespace shapemodel; using namespace std; using namespace NEWIMAGE; using namespace TRACT; @@ -39,19 +40,40 @@ void meshmask() counter.initialise(); Seedmanager seedmanager(counter); + Matrix mm_to_vox(4,4); + mm_to_vox << -1 << 0 << 0 << (seeds.xsize()-1)/2 + << 0 << 0 << -1 << (seeds.zsize()-1)/2 + << 0 << 1 << 0 << (seeds.ysize()-1)/2 + << 0 << 0 << 0 << 1; + +// shapeModel * model1 = new shapeModel; +// model1->load_vtk(opts.meshfile.value(),1); + +// model1->meshReg(&mseeds, mm_to_vox); +// model1->setShapeMesh(0,mseeds); +// model1->setImageParameters(seeds.xsize(),seeds.ysize(),seeds.zsize(),seeds.xdim(),seeds.ydim(), seeds.zdim()); + +// Mesh m = model1->getTranslatedMesh(0); +// for(vector<Mpoint*>::iterator i = m._points.begin();i!=m._points.end();i++){ +// cout<<(*i)->get_coord().X<<" "<<(*i)->get_coord().Y<<" "<<(*i)->get_coord().Z<<endl; + +// } ColumnVector fs_coord_mm(4),xyz_vox,seeddim(3); seeddim << seeds.xdim() << seeds.ydim() << seeds.zdim(); ColumnVector dir(3); int keeptotal=0; for(vector<Mpoint*>::iterator i = mseeds._points.begin();i!=mseeds._points.end();i++){ - if((*i)->get_value() > 0){ + //if((*i)->get_value() > 0){ fs_coord_mm<<(*i)->get_coord().X<<(*i)->get_coord().Y<<(*i)->get_coord().Z << 1.0; - xyz_vox = seeds.qform_mat().i()*fs_coord_mm; + // xyz_vox = seeds.qform_mat().i()*fs_coord_mm + xyz_vox = mm_to_vox*fs_coord_mm; float x=xyz_vox(1);float y=xyz_vox(2);float z=xyz_vox(3); + Pt newPt(x,y,z); + (*i)->_update_coord = newPt; seeds(round(x),round(y),round(z)) = 1; @@ -59,9 +81,10 @@ void meshmask() dir << (*i)->local_normal().X << (*i)->local_normal().Y << (*i)->local_normal().Z; keeptotal += seedmanager.run(round(x),round(y),round(z),true,-1,dir); - } + //} } - + mseeds.update(); + mseeds.save("test.vtk",3); //return; // for(int z=0;z<seeds.zsize();z++){