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