Skip to content
Snippets Groups Projects
Commit 1f716177 authored by Saad Jbabdi's avatar Saad Jbabdi
Browse files

deal with transformation from conformed fs space to voxel space

parent 24b98ce2
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include "ptx_meshmask.h" #include "ptx_meshmask.h"
#include "streamlines.h" #include "streamlines.h"
#include "shapeModel/shapeModel.h"
using namespace shapemodel;
using namespace std; using namespace std;
using namespace NEWIMAGE; using namespace NEWIMAGE;
using namespace TRACT; using namespace TRACT;
...@@ -39,19 +40,40 @@ void meshmask() ...@@ -39,19 +40,40 @@ void meshmask()
counter.initialise(); counter.initialise();
Seedmanager seedmanager(counter); 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); ColumnVector fs_coord_mm(4),xyz_vox,seeddim(3);
seeddim << seeds.xdim() << seeds.ydim() << seeds.zdim(); seeddim << seeds.xdim() << seeds.ydim() << seeds.zdim();
ColumnVector dir(3); ColumnVector dir(3);
int keeptotal=0; int keeptotal=0;
for(vector<Mpoint*>::iterator i = mseeds._points.begin();i!=mseeds._points.end();i++){ 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; 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); 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; seeds(round(x),round(y),round(z)) = 1;
...@@ -59,9 +81,10 @@ void meshmask() ...@@ -59,9 +81,10 @@ void meshmask()
dir << (*i)->local_normal().X << (*i)->local_normal().Y << (*i)->local_normal().Z; 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); keeptotal += seedmanager.run(round(x),round(y),round(z),true,-1,dir);
} //}
} }
mseeds.update();
mseeds.save("test.vtk",3);
//return; //return;
// for(int z=0;z<seeds.zsize();z++){ // for(int z=0;z<seeds.zsize();z++){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment