public void saveExtract(String fn)
 {
   int k=0;
   double wx,wy;
   extract0();
   extract1();
   
   try {
   DataOutputStream patout = openfileWRITE(fn);
   patout.writeBytes("# This hand marker file is generated by ImageProcess (Erhan Oztop -Jan'00)\n");
   patout.writeBytes("# At the time of writing this file:  picture & weight file used :"+picture.getText()+","+weight.getText()+"\n");

  
  patout.writeBytes("# WRIST\n"+"##"+limbs[WRIST]+"  ");
  if (wrist==null) { patout.writeBytes(" 0 0 0\n"); wx=0; wy=0;}
  else {patout.writeBytes(Elib.snice(wrist.x,1e3,6)+" "+
                          Elib.snice(he-wrist.y,1e3,6)+" 1.0\n"); wx=wrist.x; wy=wrist.y;}
  Point3d or=getOrientation();
  patout.writeBytes("# rotation by z axis, palmlen, N/A\n"+"orientation"+"  ");
  System.out.println("orientation:"+or.str());
  patout.writeBytes(Elib.snice(or.x,1e3,6)+" "+
                    Elib.snice(or.y,1e3,6)+" "+
                    Elib.snice(or.z,1e3,6)+"\n"); 

  patout.writeBytes("# now comes pinky_base, pinky_center, pinky_tip ... index_..\n");
  for (int i=PINKY;i<=THUMB;i++)
   {
   for (int j=0;j<=2;j++)
     {patout.writeBytes(limbs[i]+j+"  "); 
      if (fing[i][j]==null) patout.writeBytes("0 0 0\n");
      else patout.writeBytes(Elib.snice(fing[i][j].x-wx, 1e3, 6)+" "+
                             Elib.snice(-fing[i][j].y+wy, 1e3, 6)+" 1.0\n");
     }
   }
  patout.writeBytes("# THUMB\n"+limbs[THUMB]+"0  ");
  if (fing[THUMB][0]==null) patout.writeBytes("0 0 0\n");
  else patout.writeBytes(Elib.snice(fing[THUMB][0].x-wx, 1e3, 6)+" "+
                         Elib.snice(-fing[THUMB][0].y+wy, 1e3, 6)+" 1.0\n");
  patout.writeBytes("# THUMB\n"+limbs[THUMB]+"1 ");
  if (fing[THUMB][1]==null) patout.writeBytes("0 0 0\n");
  else patout.writeBytes(Elib.snice(fing[THUMB][1].x-wx, 1e3, 6)+" "+
                         Elib.snice(-fing[THUMB][1].y+wy, 1e3, 6)+" 1.0\n");

  patout.close();
  } catch (IOException e)
  { System.err.println("closePattern : EXCEPTION "+e);
   }
  System.out.println("Wrote extracted hand info in "+fn);
 }