title: Detecting finger type with mantra fingerprint sensor
body: <p>I have mantra MFS100 optical fingerprint sensor, I want to build an android app that shows the type of finger that is being scanned.</p>
  
  <p>I want to make the app such that it can show which finger is being scanned like Thumb or Index.</p>
  
  <p><strong>Note: I have successfully downloaded the mantra MFS100 Android SDK but there is no any function that can detect the type of finger being scanned</strong></p>
  
  <p>Below is the function that start capturing the finger data</p>
  
  <pre><code>private void StartSyncCapture() {
  
      // //// Use thread if you want to show preview, else no need to use
      // thread.
      new Thread(new Runnable() {
  
          @Override
          public void run() {
              SetTextonuiThread("");
              try {
                  FingerData fingerData = new FingerData();
                  int ret = mfs100.AutoCapture(fingerData, timeout, true,
                          false);
                  if (ret != 0) {
                      SetTextonuiThread(mfs100.GetErrorMsg(ret));
                  } else {
                      final Bitmap bitmap = BitmapFactory.decodeByteArray(
                              fingerData.FingerImage(), 0,
                              fingerData.FingerImage().length);
                      imgFinger.post(new Runnable() {
                          @Override
                          public void run() {
                              imgFinger.setImageBitmap(bitmap);
                              imgFinger.refreshDrawableState();
                          }
                      });
  
                      SetTextonuiThread("Capture Success");
                      String log = "\nQuality: " + fingerData.Quality()
                              + "\nNFIQ: " + fingerData.Nfiq()
                              + "\nWSQ Compress Ratio: "
                              + fingerData.WSQCompressRatio()
                              + "\nImage Dimensions (inch): "
                              + fingerData.InWidth() + "\" X "
                              + fingerData.InHeight() + "\""
                              + "\nImage Area (inch): " + fingerData.InArea()
                              + "\"" + "\nResolution (dpi/ppi): "
                              + fingerData.Resolution() + "\nGray Scale: "
                              + fingerData.GrayScale() + "\nBits Per Pixal: "
                              + fingerData.Bpp() + "\nWSQ Info: "
                              + fingerData.WSQInfo();
                      SetLogOnUIThread(log);
  
                      //////////////////// Extract ANSI Template
                      byte[] tempData = new byte[2000]; // length 2000 is mandatory
                      byte[] ansiTemplate = null;
                      int dataLen = mfs100.ExtractANSITemplate(fingerData.RawData(), tempData);
                      if(dataLen&lt;=0)
                      {
                          if(dataLen==0)
                          {
                              SetTextonuiThread("Failed to extract ANSI Template");
                          }
                          else
                          {
                              SetTextonuiThread(mfs100.GetErrorMsg(dataLen));
                          }
                          return;
                      }
                      else
                      {
                          ansiTemplate = new byte[dataLen];
                          System.arraycopy(tempData, 0, ansiTemplate, 0,
                                  dataLen);
                      }
                      //////////////////////////////////////////////
  
                      //////////////////// Extract ISO Image
                      dataLen=0;
                      tempData = new byte[(mfs100.GetDeviceInfo().Width() * mfs100.GetDeviceInfo().Height())+1078]; 
                      byte[] isoImage = null;
                      dataLen = mfs100.ExtractISOImage(fingerData.RawData(),tempData);
                      if(dataLen&lt;=0)
                      {
                          if(dataLen==0)
                          {
                              SetTextonuiThread("Failed to extract ISO Image");
                          }
                          else
                          {
                              SetTextonuiThread(mfs100.GetErrorMsg(dataLen));
                          }
                          return;
                      }
                      else
                      {
                          isoImage = new byte[dataLen];
                          System.arraycopy(tempData, 0, isoImage, 0,
                                  dataLen);
                      }
                      //////////////////////////////////////////////
  
                      //////////////////// Extract WSQ Image
                      dataLen=0;
                      tempData = new byte[(mfs100.GetDeviceInfo().Width() * mfs100.GetDeviceInfo().Height())+1078];
                      byte[] wsqImage = null;
                      dataLen = mfs100.ExtractWSQImage(fingerData.RawData(),tempData);
  
                      if(dataLen&lt;=0)
                      {
                          if(dataLen==0)
                          {
                              SetTextonuiThread("Failed to extract WSQ Image");
                          }
                          else
                          {
                              SetTextonuiThread(mfs100.GetErrorMsg(dataLen));
                          }
                          return;
                      }
                      else
                      {
                          wsqImage = new byte[dataLen];
                          System.arraycopy(tempData, 0, wsqImage, 0,
                                  dataLen);
                      }
                      //////////////////////////////////////////////
  
                      SetData2(fingerData,ansiTemplate,isoImage,wsqImage);
                  }
              } catch (Exception ex) {
                  SetTextonuiThread("Error");
              }
          }
      }).start();
  }
  </code></pre>