26 #include "geometry.hh"
33 bool CExtractionImage::extract3dImageWithPrecodes(CImage3d * AImage,
int ALevel,
35 bool AKeepFictiveEdges,
36 bool AShiftFictiveEdges)
38 assert(AImage != NULL);
39 if (!AImage->isOk())
return false;
42 int fictiveMark = FMap->getNewMark();
44 CDart *last, *up, *behind;
48 CVertex CurrentPointel(1,1,1);
54 #ifdef DEBUG_EXTRACT_IMAGE
55 cout<<
"Avant de créer le bord supérieur : "<<endl;
58 last = createBorder3d(AImage->getWidth(),AImage->getHeight());
60 #ifdef DEBUG_EXTRACT_IMAGE
61 cout<<
"Ok on FMap->alpha créé le bord supérieur."<<endl;
66 for (
unsigned int j=0; j<=AImage->getHeight(); ++j)
68 for (
unsigned int i=0; i<=AImage->getWidth(); ++i)
70 #ifdef DEBUG_EXTRACT_IMAGE
71 cout<<
"On traite le voxel ("<<i<<
", "<<j<<
", "<<k<<
")"<<endl;
76 CDart* tmp = createCubeForExtract3d(CurrentPointel);
78 last = FMap->alpha101(tmp);
82 up = computeUpFromLast3d(last);
83 behind = computeBehindFromLast3d(last);
85 if ( AImage->sameVoxelActuLeft(i,j) )
87 if ( AImage->sameVoxelActuBehind(i,j) )
89 if ( AImage->sameVoxelActuUp(i,j) )
90 subcasePrecodeL8(*AImage,i,j,last,up,behind,
91 ALevel,CurrentPointel, fictiveMark,
95 subcasePrecodeL5(*AImage,i,j,last,up,behind,
96 ALevel,CurrentPointel, fictiveMark,
102 if ( AImage->sameVoxelActuUp(i,j) )
103 subcasePrecodeL6(*AImage,i,j,last,up,behind,
104 ALevel,CurrentPointel, fictiveMark,
108 subcasePrecodeL2(*AImage,i,j,last,up,behind,
109 ALevel,CurrentPointel, fictiveMark,
116 if ( AImage->sameVoxelActuBehind(i,j) )
118 if ( AImage->sameVoxelActuUp(i,j) )
119 subcasePrecodeL7(*AImage,i,j,last,up,behind,
120 ALevel,CurrentPointel, fictiveMark,
124 subcasePrecodeL4(*AImage,i,j,last,up,behind,
125 ALevel,CurrentPointel, fictiveMark,
131 if ( AImage->sameVoxelActuUp(i,j) )
132 subcasePrecodeL3(*AImage,i,j,last,up,behind,
133 ALevel,CurrentPointel,fictiveMark,
137 subcasePrecodeL1(*AImage,i,j,last,up,behind,
138 ALevel,CurrentPointel, fictiveMark,
151 if ( i == AImage->getWidth()-1 )
153 CurrentPointel.setX(0);
155 if ( j == AImage->getHeight()-1 )
157 CurrentPointel.setY(0);
158 CurrentPointel.setZ(CurrentPointel.getZ()+1);
161 CurrentPointel.setY(CurrentPointel.getY()+1);
164 CurrentPointel.setX(CurrentPointel.getX()+1);
168 std::cout <<
"Ok pour l'extraction de la plaque num "
169 << AImage->getPlaneActu() << std::endl;
172 while(AImage->readNextPlane());
174 FMap->unmarkAll(fictiveMark);
175 FMap->freeMark(fictiveMark);
177 if (ADestroyBorder && ALevel > 0)
179 CStaticCoverage012 it(FMap,last);
181 FMap->delMapDart(it++);
188 bool CExtractionImage::extract3dImageWithPrecodes(
const std::string & AFilename,
194 bool KeepFictiveEdges,
195 bool ShiftFictiveEdges )
197 #ifdef MODULE_EXTRACTION_IMAGE_WITHOUT_MAGICK
200 CImage3dMagick image(AFilename, FirstPlane, NbPlaneToRead, Lg);
202 return extract3dImageWithPrecodes(& image, Level,
206 #endif // MODULE_EXTRACTION_IMAGE_WITHOUT_MAGICK
210 bool CExtractionImage::
211 extract3dImageCEAWithPrecodes(
const std::string & AFilename,
216 bool KeepFictiveEdges,
217 bool ShiftFictiveEdges )
219 CImage3dCEA image(AFilename, FirstPlane, NbPlaneToRead);
221 return extract3dImageWithPrecodes(& image, Level,