8 #include "brukerdataset.h"
9 #include "brukerkspaceobject.h"
10 #include "brukerimage.h"
13 int main(int argc, char *argv[])
15 BrukerDataSet acqp1, reco1;
16 std::string file2Read1("/home/denis/TestDicom/kiwidicom.QZ1/3/acqp");
17 std::string file2Read2("/home/denis/TestDicom/kiwidicom.QZ1/3/pdata/1/reco");
18 //std::string file2Read("/home/denis/TestDicom/mcao31a.pc1-exam_fabien/6/acqp");
19 //std::string file2Read("/home/denis/TestDicom/mcao31a.pc1-exam_fabien/6/pdata/1/reco");
20 //std::string file2Read("/home/denis/TestDicom/mcao31a.pc1-exam_fabien/6/acqp");
21 acqp1.LoadFile(file2Read1);
22 reco1.LoadFile(file2Read2);
23 std::cout << "=============== acqp1 FillMap =================" << std::endl;
26 std::cout << "=============== End acqp1 FillMap =================" << std::endl;
27 std::cout << "=============== reco1 FillMap =================" << std::endl;
30 std::cout << "=============== End reco1 FillMap =================" << std::endl;
34 std::cout << "=============== BuildLoopStructure =================" << std::endl;
36 // LoopStructure is used to control the way the loops can be unrolled (in ObjectsLineList)
37 acqp1.SetLoopStructure();
38 std::vector<int> TempVect = acqp1.GetLoopStructure() ;
39 for(int i=0;i<TempVect.size();i++){
40 std::cout<<"GenericLoopStructure["<<i<<"]="<<TempVect[i]<<std::endl;
42 std::cout << "=============== End BuildLoopStructure =================" << std::endl;
44 std::cout << "=============== SetBrukerObjectsLineStructure =================" << std::endl;
46 // ObjectsLineList is a matrix containing for each line acquired which was its position in the acquisition loop
47 // This position do not take into account an eventual slice interleaved acquisition
49 acqp1.SetBrukerObjectsLineList();
50 std::vector<std::vector<int> > TempMat=acqp1.GetBrukerObjectsLineList();
51 std::map<std::string, BrukerFieldData> Map=acqp1.GetBrukerHeaderMap();
53 //ObjectVaryingProperties is a method centralizing the access to "all" the varying properties of images like position, orientation, echo time, .....
54 //It needs the BrukerHeaderMap and the LoopStructure as input
56 bool result=acqp1.ObjectVaryingProperties.init(Map,TempVect);
57 int Reordered,i,j,k,l;
58 std::vector<std::vector<double> > TempMat2;
59 for(int i=0;i<TempMat.size();i++){
60 std::cout<<std::endl<<"["<<i<<"] ";
61 for (int j=0;j<TempMat[0].size();j++)
62 std::cout<< "["<<TempMat[i][j]<<"] ";
63 // fugly trick but sofar the eventual interleaved information applies to the slice loop =>BrukerObjectsLineList[*][2]
64 Reordered=acqp1.ObjectVaryingProperties.getAcquisitionOrder(TempMat[i][2]);
65 std::cout<<" TE = "<<acqp1.ObjectVaryingProperties.getTE(TempMat[i][0]);
66 // And the Reordering applies to values "constructed" exterior to the slice loop (ie : BrukerObjectsLineList[*][>=2])
67 std::cout<<" [R,P,S]xyz = ["<<acqp1.ObjectVaryingProperties.getPositionR(Reordered);
68 std::cout<<" , "<<acqp1.ObjectVaryingProperties.getPositionP(Reordered);
69 std::cout<<" , "<<acqp1.ObjectVaryingProperties.getPositionS(Reordered)<<"] ";
70 TempMat2=acqp1.ObjectVaryingProperties.getOrientation(Reordered);
71 std::cout<<" [R,P,S]orient = [";
74 for (l=0;l<=2;l++) std::cout<< TempMat2[k][l]<<" ";
78 std::cout<<" Slice Number = "<<Reordered<<" ";
79 std::cout<<" TimePositionPerNR = "<<acqp1.ObjectVaryingProperties.getPositionTimePerNR(TempMat[i].back());
82 std::cout << "=============== End SetBrukerObjectsLineStructure =================" << std::endl;
84 //Same routine as above but instead of scruting the loop structure of raw data
85 //we deal with an image structure so the loops used to construct an image do not appear anymore
86 //but apparently the interleaveness stand still
88 std::cout << "=============== Begin BrukerImageStructure=================" << std::endl;
89 acqp1.SetImageLoopStructure();
90 acqp1.SetBrukerImageList();
91 std::vector<std::vector<int> > BrukerImageList=acqp1.GetBrukerImageList();
92 std::vector<std::vector<double> > BrukerImageList2;
93 for(int i=0;i<BrukerImageList.size();i++){
94 std::cout<<std::endl<<"["<<i<<"] ";
95 for (int j=0;j<BrukerImageList[0].size();j++)
96 std::cout<< "["<<BrukerImageList[i][j]<<"] ";
97 Reordered=acqp1.ObjectVaryingProperties.getAcquisitionOrder(BrukerImageList[i][2]);
98 std::cout<<" TE = "<<acqp1.ObjectVaryingProperties.getTE(BrukerImageList[i][0]);
99 std::cout<<" [R,P,S]xyz = ["<<acqp1.ObjectVaryingProperties.getPositionR(Reordered);
100 std::cout<<" , "<<acqp1.ObjectVaryingProperties.getPositionP(Reordered);
101 std::cout<<" , "<<acqp1.ObjectVaryingProperties.getPositionS(Reordered)<<"] ";
102 BrukerImageList2=acqp1.ObjectVaryingProperties.getOrientation(Reordered);
103 std::cout<<" [R,P,S]orient = [";
107 std::cout<< BrukerImageList2[k][l]<<" ";
111 std::cout<<" Slice Number = "<<Reordered<<" ";
112 std::cout<<" TimePositionPerNR = "<<acqp1.ObjectVaryingProperties.getPositionTimePerNR(BrukerImageList[i].back());
114 std::cout<<std::endl;
115 std::cout << "=============== End BrukerImageStructure=============" << std::endl;
118 BrukerImage Image(acqp1,reco1);
119 Image.Init(acqp1,reco1,1);
120 std::vector<BrukerImage> ImageSet;
122 for(int i=0;i<BrukerImageList.size();i++){
123 Image.Init(acqp1,reco1,i);
124 ImageSet.push_back(Image);
127 std::string fid("/home/denis/TestDicom/kiwidicom.QZ1/3/fid");
128 std::cout << "=============== Getkspace =================" << std::endl;
129 acqp1.Getkspace(fid);
130 std::cout << "=============== End Getkspace =================" << std::endl;