25 #ifdef MODULE_EXTRACTION_IMAGE
27 #ifndef EXTRACTION_IMAGES_HH
28 #define EXTRACTION_IMAGES_HH
30 #include "inline-macro.hh"
35 #ifndef MODULE_EXTRACTION_IMAGE_WITHOUT_MAGICK
52 class CExtractionImage
57 CExtractionImage(CGMapVertex * AMap);
71 bool extract2dImage(
const std::string & AFilename);
91 bool extract3dImage(
const std::string & AFilename,
int FirstPlane,
92 int NbPlaneToRead,
int Level,
int Lg,
94 bool KeepFictiveEdges,
bool ShiftFictiveEdges);
113 bool extract3dImageCEA(
const std::string & AFilename,
int FirstPlane,
114 int NbPlaneToRead,
int Level,
115 bool DestroyBorder,
bool KeepFictiveEdges,
116 bool ShiftFictiveEdges );
126 bool extract3dImageWithPrecodes(
const std::string & AFilename,
128 int NbPlaneToRead,
int Level,
int Lg,
130 bool KeepFictiveEdges,
131 bool ShiftFictiveEdges );
141 bool extract3dImageCEAWithPrecodes(
const std::string & AFilename,
143 int NbPlaneToRead,
int Level,
145 bool KeepFictiveEdges,
146 bool ShiftFictiveEdges );
166 bool extractOneRegionVoxels(
const std::string & AFilename,
170 int ARed,
int AGreen,
int ABlue,
int AAlpha );
176 #ifndef MODULE_EXTRACTION_IMAGE_WITHOUT_MAGICK
178 CDart* computeUpFromLast2d(CDart* ADart);
180 CDart* createBorder2d(
unsigned int rows);
181 CDartVertex* createFaceForExtract2d(
unsigned int x,
unsigned int y);
183 bool samePixelActuLeft2d(Magick::Image & image,
184 unsigned int x,
unsigned int y);
185 bool samePixelActuUp2d (Magick::Image & image,
186 unsigned int x,
unsigned int y);
188 void mergeImage2dFaces(CDart* ADart);
189 void mergeImage2dEdges(CDart* ADart);
191 bool isDegre2Vertex2d(CDart* ADart);
193 #endif // MODULE_EXTRACTION_IMAGE_WITHOUT_MAGICK
195 bool areEdgesAlign(CDart* ADart, CDart* ADart2);
209 bool extract3dImage(CImage3d * AImage,
int ALevel = 3,
210 bool ADestroyBorder =
true,
211 bool AKeepFictiveEdges =
true,
212 bool AShiftFictiveEdges =
true);
226 bool extractOneRegionVoxels(CImage3d * AImage,
227 int ARed,
int AGreen,
int ABlue,
int AAlpha );
229 CDart* computeUpFromLast3d (CDart* ADart);
230 CDart* computeBehindFromLast3d(CDart* ADart);
232 CDart* createBorder3d(
unsigned int columns,
unsigned int rows);
233 CDartVertex* createFaceForExtract3d();
234 CDartVertex* createFaceForExtract3d(
const CVertex & AVertex );
235 CDartVertex* createCubeForExtract3d(
const CVertex & AVertex );
236 void sew3Cube(CDart* ADart, CDart* TheLastDart);
238 void mergeImage3dVolumes(CDart* ADart);
239 void mergeImage3dFaces (CDart* ADart);
240 void mergeImage3dEdges (CDart* ADart);
242 bool isDegre2Edge3d (CDart* ADart);
243 bool isDegre2Vertex3d (CDart* ADart);
244 CDart* isRealDegre2Vertex3d (CDart* ADart,
int AMark);
245 bool areFacesColinear (CDart* ADart);
246 bool faceMergingWillDisconnect(CDart* ADart);
248 bool extract3dImageWithPrecodes(CImage3d * AImage,
int ALevel = 3,
249 bool ADestroyBorder =
true,
250 bool AKeepFictiveEdges =
true,
251 bool AShiftFictiveEdges =
true);
254 void closeFace( CDart* d1, CDart* d2,CDart* d3 );
255 void closeFace( CDart* d1, CDart* d2 );
256 void closeFace( CDart* d );
258 void shiftFictiveEdgesForFacesXy( CDart* last, CDart* up, CDart* behind,
260 void shiftFictiveEdgesForFacesXz( CDart* last, CDart* up, CDart* behind,
262 void shiftFictiveEdgesForFacesYz( CDart* last, CDart* up, CDart* behind,
266 CDart* oneSameNeighboorV( CDart* d1, CDart* fo1, CDart* fo2,
267 const CVertex & AVertex );
268 CDart* twoSameNeighboorV( CDart* d1, CDart* d5 , CDart* fo ,
269 const CVertex & AVertex );
271 void precodeL1( CDart* &last, CDart* up, CDart* behind,
272 const CVertex & AVertex );
273 void precodeL2( CDart* &last, CDart* up, CDart* behind,
274 const CVertex & AVertex );
275 void precodeL3( CDart* &last, CDart* up, CDart* behind,
276 const CVertex & AVertex );
277 void precodeL4( CDart* &last, CDart* up, CDart* behind,
278 const CVertex & AVertex );
279 void precodeL5( CDart* &last, CDart* up, CDart* behind,
280 const CVertex & AVertex );
281 void precodeL6( CDart* &last, CDart* up, CDart* behind,
282 const CVertex & AVertex );
283 void precodeL7( CDart* &last, CDart* up, CDart* behind,
284 const CVertex & AVertex );
285 void precodeL8( CDart* &last, CDart* up, CDart* behind,
286 const CVertex & AVertex );
288 void subcasePrecodeL1( CImage3d & image,
289 unsigned int x,
unsigned int y,
290 CDart* &last, CDart* up, CDart* behind,
291 int level,
const CVertex & AVertex,
int FictiveMark,
292 bool keepFictiveEdges,
bool shiftFictiveEdges );
293 void subcasePrecodeL2( CImage3d & image,
294 unsigned int x,
unsigned int y,
295 CDart* &last, CDart* up, CDart* behind,
296 int level,
const CVertex & AVertex,
int FictiveMark,
297 bool keepFictiveEdges,
bool shiftFictiveEdges );
298 void subcasePrecodeL3( CImage3d & image,
299 unsigned int x,
unsigned int y,
300 CDart* &last, CDart* up, CDart* behind,
301 int level,
const CVertex & AVertex,
int FictiveMark,
302 bool keepFictiveEdges,
bool shiftFictiveEdges );
303 void subcasePrecodeL4( CImage3d & image,
304 unsigned int x,
unsigned int y,
305 CDart* &last, CDart* up, CDart* behind,
306 int level,
const CVertex & AVertex,
int FictiveMark,
307 bool keepFictiveEdges,
bool shiftFictiveEdges );
308 void subcasePrecodeL5( CImage3d & image,
309 unsigned int x,
unsigned int y,
310 CDart* &last, CDart* up, CDart* behind,
311 int level,
const CVertex & AVertex,
int FictiveMark,
312 bool keepFictiveEdges,
bool shiftFictiveEdges );
313 void subcasePrecodeL6( CImage3d & image,
314 unsigned int x,
unsigned int y,
315 CDart* &last, CDart* up, CDart* behind,
316 int level,
const CVertex & AVertex,
int FictiveMark,
317 bool keepFictiveEdges,
bool shiftFictiveEdges );
318 void subcasePrecodeL7( CImage3d & image,
319 unsigned int x,
unsigned int y,
320 CDart* &last, CDart* up, CDart* behind,
321 int level,
const CVertex & AVertex,
int FictiveMark,
322 bool keepFictiveEdges,
bool shiftFictiveEdges );
323 void subcasePrecodeL8( CImage3d & image,
324 unsigned int x,
unsigned int y,
325 CDart* &last, CDart* up, CDart* behind,
326 int level,
const CVertex & AVertex,
int FictiveMark,
327 bool keepFictiveEdges,
bool shiftFictiveEdges );
330 CDart* oneSameNeighboorFc (
const CVertex & AVertex,
331 CDart* d1, CDart* fo1, CDart* fo2,
333 CDart* twoSameNeighboorFc1(
const CVertex & AVertex,
334 CDart* d1, CDart* d5, CDart* fo );
335 CDart* twoSameNeighboorFc2(
const CVertex & AVertex,
336 CDart* d1, CDart* d5, CDart* fo );
337 CDart* twoSameNeighboorFc3(
const CVertex & AVertex,
338 CDart* d1, CDart* d5, CDart* fo );
340 void precodeFc1 ( CDart* &last, CDart* up, CDart* behind,
341 const CVertex & AVertex );
342 void precodeFc2 ( CDart* &last, CDart* up, CDart* behind,
343 const CVertex & AVertex );
344 void precodeFc3 ( CDart* &last, CDart* up, CDart* behind,
345 const CVertex & AVertex );
346 void precodeFc4 ( CDart* &last, CDart* up, CDart* behind,
347 const CVertex & AVertex );
348 void precodeFc5 ( CDart* &last, CDart* up, CDart* behind,
349 const CVertex & AVertex );
350 void precodeFc6 ( CDart* &last, CDart* up, CDart* behind,
351 const CVertex & AVertex );
352 void precodeFc7 ( CDart* &last, CDart* up, CDart* behind,
353 const CVertex & AVertex );
354 void precodeFc8 ( CDart* &last, CDart* up, CDart* behind,
355 const CVertex & AVertex );
356 void precodeFc9 ( CDart* &last, CDart* up, CDart* behind,
357 const CVertex & AVertex );
358 void precodeFc10( CDart* &last, CDart* up, CDart* behind,
359 const CVertex & AVertex );
360 void precodeFc11( CDart* &last, CDart* up, CDart* behind,
361 const CVertex & AVertex );
362 void precodeFc12( CDart* &last, CDart* up, CDart* behind,
363 const CVertex & AVertex );
364 void precodeFc13( CDart* &last, CDart* up, CDart* behind,
365 const CVertex & AVertex );
366 void precodeFc14( CDart* &last, CDart* up, CDart* behind,
367 const CVertex & AVertex );
368 void precodeFc15( CDart* &last, CDart* up, CDart* behind,
369 const CVertex & AVertex );
370 void precodeFc16( CDart* &last, CDart* up, CDart* behind,
371 const CVertex & AVertex );
372 void precodeFc17( CDart* &last, CDart* up, CDart* behind,
373 const CVertex & AVertex );
374 void precodeFc18( CDart* &last, CDart* up, CDart* behind,
375 const CVertex & AVertex );
377 void subcasePrecodeFc1 ( CImage3d & image,
378 unsigned int x,
unsigned int y,
379 CDart* &last, CDart* up, CDart* behind,
380 int level,
const CVertex & AVertex,
382 bool keepFictiveEdges,
bool shiftFictiveEdges );
383 void subcasePrecodeFc2 ( CImage3d & image,
384 unsigned int x,
unsigned int y,
385 CDart* &last, CDart* up, CDart* behind,
386 int level,
const CVertex & AVertex,
388 bool keepFictiveEdges,
bool shiftFictiveEdges );
389 void subcasePrecodeFc3 ( CImage3d & image,
390 unsigned int x,
unsigned int y,
391 CDart* &last, CDart* up, CDart* behind,
392 int level,
const CVertex & AVertex,
394 bool keepFictiveEdges,
bool shiftFictiveEdges );
395 void subcasePrecodeFc4 ( CImage3d & image,
396 unsigned int x,
unsigned int y,
397 CDart* &last, CDart* up, CDart* behind,
398 int level,
const CVertex & AVertex,
400 bool keepFictiveEdges,
bool shiftFictiveEdges );
401 void subcasePrecodeFc5 ( CImage3d & image,
402 unsigned int x,
unsigned int y,
403 CDart* &last, CDart* up, CDart* behind,
404 int level,
const CVertex & AVertex,
406 bool keepFictiveEdges,
bool shiftFictiveEdges );
407 void subcasePrecodeFc6 ( CImage3d & image,
408 unsigned int x,
unsigned int y,
409 CDart* &last, CDart* up, CDart* behind,
410 int level,
const CVertex & AVertex,
412 bool keepFictiveEdges,
bool shiftFictiveEdges );
413 void subcasePrecodeFc7 ( CImage3d & image,
414 unsigned int x,
unsigned int y,
415 CDart* &last, CDart* up, CDart* behind,
416 int level,
const CVertex & AVertex,
418 bool keepFictiveEdges,
bool shiftFictiveEdges );
419 void subcasePrecodeFc8 ( CImage3d & image,
420 unsigned int x,
unsigned int y,
421 CDart* &last, CDart* up, CDart* behind,
422 int level,
const CVertex & AVertex,
424 bool keepFictiveEdges,
bool shiftFictiveEdges );
425 void subcasePrecodeFc9 ( CImage3d & image,
426 unsigned int x,
unsigned int y,
427 CDart* &last, CDart* up, CDart* behind,
428 int level,
const CVertex & AVertex,
430 bool keepFictiveEdges,
bool shiftFictiveEdges );
431 void subcasePrecodeFc10( CImage3d & image,
432 unsigned int x,
unsigned int y,
433 CDart* &last, CDart* up, CDart* behind,
434 int level,
const CVertex & AVertex,
436 bool keepFictiveEdges,
bool shiftFictiveEdges );
437 void subcasePrecodeFc11( CImage3d & image,
438 unsigned int x,
unsigned int y,
439 CDart* &last, CDart* up, CDart* behind,
440 int level,
const CVertex & AVertex,
442 bool keepFictiveEdges,
bool shiftFictiveEdges );
443 void subcasePrecodeFc12( CImage3d & image,
444 unsigned int x,
unsigned int y,
445 CDart* &last, CDart* up, CDart* behind,
446 int level,
const CVertex & AVertex,
448 bool keepFictiveEdges,
bool shiftFictiveEdges );
449 void subcasePrecodeFc13( CImage3d & image,
450 unsigned int x,
unsigned int y,
451 CDart* &last, CDart* up, CDart* behind,
452 int level,
const CVertex & AVertex,
454 bool keepFictiveEdges,
bool shiftFictiveEdges );
455 void subcasePrecodeFc14( CImage3d & image,
456 unsigned int x,
unsigned int y,
457 CDart* &last, CDart* up, CDart* behind,
458 int level,
const CVertex & AVertex,
460 bool keepFictiveEdges,
bool shiftFictiveEdges );
461 void subcasePrecodeFc15( CImage3d & image,
462 unsigned int x,
unsigned int y,
463 CDart* &last, CDart* up, CDart* behind,
464 int level,
const CVertex & AVertex,
466 bool keepFictiveEdges,
bool shiftFictiveEdges );
467 void subcasePrecodeFc16( CImage3d & image,
468 unsigned int x,
unsigned int y,
469 CDart* &last, CDart* up, CDart* behind,
470 int level,
const CVertex & AVertex,
472 bool keepFictiveEdges,
bool shiftFictiveEdges );
473 void subcasePrecodeFc17( CImage3d & image,
474 unsigned int x,
unsigned int y,
475 CDart* &last, CDart* up, CDart* behind,
476 int level,
const CVertex & AVertex,
478 bool keepFictiveEdges,
bool shiftFictiveEdges );
479 void subcasePrecodeFc18( CImage3d & image,
480 unsigned int x,
unsigned int y,
481 CDart* &last, CDart* up, CDart* behind,
482 int level,
const CVertex & AVertex,
484 bool keepFictiveEdges,
bool shiftFictiveEdges );
487 CDart* oneSameNeighboorF (CDart* d1, CDart* fo1, CDart* fo2,
488 const CVertex & AVertex );
489 CDart* twoSameNeighboorF1 (CDart* d1, CDart* d5, CDart* fo,
490 const CVertex & AVertex );
491 CDart* twoSameNeighboorF2 (CDart* d1, CDart* d5, CDart* fo,
492 const CVertex & AVertex );
493 CDart* threeSameNeighboorF(CDart* d1, CDart* d5, CDart* fo,
494 const CVertex & AVertex );
496 void precodesF1F4F7F10( CDart* &last, CDart* up, CDart* behind,
497 const CVertex & AVertex );
498 void precodesF2F5F8F11( CDart* &last, CDart* up, CDart* behind,
499 const CVertex & AVertex );
500 void precodesF3F6F9F12( CDart* &last, CDart* up, CDart* behind,
501 const CVertex & AVertex );
502 void precodesF13F19 ( CDart* &last, CDart* up, CDart* behind,
503 const CVertex & AVertex );
504 void precodesF14F20 ( CDart* &last, CDart* up, CDart* behind,
505 const CVertex & AVertex );
506 void precodesF15F21 ( CDart* &last, CDart* up, CDart* behind,
507 const CVertex & AVertex );
508 void precodesF16F22 ( CDart* &last, CDart* up, CDart* behind,
509 const CVertex & AVertex );
510 void precodesF17F23 ( CDart* &last, CDart* up, CDart* behind,
511 const CVertex & AVertex );
512 void precodesF18F24 ( CDart* &last, CDart* up, CDart* behind,
513 const CVertex & AVertex );
514 void precodeF25 ( CDart* &last, CDart* up, CDart* behind,
515 const CVertex & AVertex );
516 void precodeF26 ( CDart* &last, CDart* up, CDart* behind,
517 const CVertex & AVertex );
518 void precodeF27 ( CDart* &last, CDart* up, CDart* behind,
519 const CVertex & AVertex );
522 void subcasePrecodesF1F4F7F10( CImage3d & image,
523 unsigned int x,
unsigned int y,
524 CDart* &last, CDart* up, CDart* behind,
525 int level,
const CVertex & AVertex,
527 bool keepFictiveEdges,
528 bool shiftFictiveEdges );
529 void subcasePrecodesF2F5F8F11( CImage3d & image,
530 unsigned int x,
unsigned int y,
531 CDart* &last, CDart* up, CDart* behind,
532 int level,
const CVertex & AVertex,
534 bool keepFictiveEdges,
535 bool shiftFictiveEdges );
536 void subcasePrecodesF3F6F9F12( CImage3d & image,
537 unsigned int x,
unsigned int y,
538 CDart* &last, CDart* up, CDart* behind,
539 int level,
const CVertex & AVertex,
541 bool keepFictiveEdges,
542 bool shiftFictiveEdges );
543 void subcasePrecodesF13F19( CImage3d & image,
544 unsigned int x,
unsigned int y,
545 CDart* &last, CDart* up, CDart* behind,
546 int level,
const CVertex & AVertex,
548 bool keepFictiveEdges,
549 bool shiftFictiveEdges );
550 void subcasePrecodesF14F20( CImage3d & image,
551 unsigned int x,
unsigned int y,
552 CDart* &last, CDart* up, CDart* behind,
553 int level,
const CVertex & AVertex,
555 bool keepFictiveEdges,
bool shiftFictiveEdges );
556 void subcasePrecodesF15F21( CImage3d & image,
557 unsigned int x,
unsigned int y,
558 CDart* &last, CDart* up, CDart* behind,
559 int level,
const CVertex & AVertex,
561 bool keepFictiveEdges,
bool shiftFictiveEdges );
562 void subcasePrecodesF16F22( CImage3d & image,
563 unsigned int x,
unsigned int y,
564 CDart* &last, CDart* up, CDart* behind,
565 int level,
const CVertex & AVertex,
567 bool keepFictiveEdges,
bool shiftFictiveEdges );
568 void subcasePrecodesF17F23( CImage3d & image,
569 unsigned int x,
unsigned int y,
570 CDart* &last, CDart* up, CDart* behind,
571 int level,
const CVertex & AVertex,
573 bool keepFictiveEdges,
bool shiftFictiveEdges );
574 void subcasePrecodesF18F24( CImage3d & image,
575 unsigned int x,
unsigned int y,
576 CDart* &last, CDart* up, CDart* behind,
577 int level,
const CVertex & AVertex,
579 bool keepFictiveEdges,
bool shiftFictiveEdges );
580 void subcasePrecodeF25( CImage3d & image,
581 unsigned int x,
unsigned int y,
582 CDart* &last, CDart* up, CDart* behind,
583 int level,
const CVertex & AVertex,
int FictiveMark,
584 bool keepFictiveEdges,
bool shiftFictiveEdges );
585 void subcasePrecodeF26( CImage3d & image,
586 unsigned int x,
unsigned int y,
587 CDart* &last, CDart* up, CDart* behind,
588 int level,
const CVertex & AVertex,
int FictiveMark,
589 bool keepFictiveEdges,
bool shiftFictiveEdges );
590 void subcasePrecodeF27( CImage3d & image,
591 unsigned int x,
unsigned int y,
592 CDart* &last, CDart* up, CDart* behind,
593 int level,
const CVertex & AVertex,
int FictiveMark,
594 bool keepFictiveEdges,
bool shiftFictiveEdges );
597 bool FKeepFictiveEdges;
598 bool FShiftFictiveEdges;
604 #include INCLUDE_INLINE("extraction-images.icc")
606 #endif // EXTRACTION_IMAGES_HH
608 #endif // MODULE_EXTRACTION_IMAGE