15#if defined(USE_VECTOR) 
   25using namespace Magick;
 
   27int main( 
int , 
char ** argv)
 
   31  InitializeMagick(*argv);
 
   38    if(getenv(
"SRCDIR") != 0)
 
   39      srcdir = getenv(
"SRCDIR");
 
   43    image.read( srcdir + 
"test_image.miff" );
 
   47    std::map<Color,size_t> histogram;
 
   48#elif defined(USE_VECTOR) 
   49    std::vector<std::pair<Color,size_t> > histogram;
 
   52    colorHistogram( &histogram, image );
 
   55#if (MAGICKCORE_QUANTUM_DEPTH == 8) 
   57#elif (MAGICKCORE_QUANTUM_DEPTH == 16) 
   63    cout << 
"Histogram for file \"" << image.fileName() << 
"\"" << endl
 
   64         << histogram.size() << 
" entries:" << endl;
 
   67    std::map<Color,size_t>::const_iterator p=histogram.begin();
 
   68#elif defined(USE_VECTOR) 
   69    std::vector<std::pair<Color,size_t> >::const_iterator p=histogram.begin();
 
   71    while (p != histogram.end())
 
   73        cout << setw(10) << (int)p->second << 
": (" 
   74             << setw(quantum_width) << (int)p->first.redQuantum() << 
"," 
   75             << setw(quantum_width) << (int)p->first.greenQuantum() << 
"," 
   76             << setw(quantum_width) << (int)p->first.blueQuantum() << 
")" 
   84      cout << 
"Caught exception: " << error_.what() << endl;
 
   87  catch( exception &error_ )
 
   89      cout << 
"Caught exception: " << error_.what() << endl;
 
   95      cout << failures << 
" failures" << endl;