• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TImage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TImage的典型用法代码示例。如果您正苦于以下问题:C++ TImage类的具体用法?C++ TImage怎么用?C++ TImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DrawText

void TThumbGeneratorImpl::DrawText(TImage& image, size_t x, size_t y, const wstring& wtext, size_t size) {
    float scale = stbtt_ScaleForPixelHeight(&Font, size);

    int w, h, xo, yo;
    unsigned char* r = image.data(0, 0, 0, 0);
    unsigned char* g = image.data(0, 0, 0, 1);
    unsigned char* b = image.data(0, 0, 0, 2);

    size_t pos = x;
    for (size_t i = 0; i < wtext.size(); i++) {
        if (iswspace(wtext[i])) {
            pos += size * 0.3;
            continue;
        }
        unsigned char* d = stbtt_GetCodepointBitmap(&Font, 0, scale, wtext[i], &w, &h, &xo, &yo);
        for (size_t wx = 0; wx < w; wx++) {
            for (size_t wy = 0; wy < h; wy++) {
                size_t cx = pos + wx + xo;
                size_t cy = y + wy + yo + size;
                if (cy >= image.height() ||
                        cx >= image.width())
                {
                    continue;
                }
                size_t dcord = image.width() * cy + cx;
                size_t scord = wy * w + wx;
                r[dcord] = d[scord];
                g[dcord] = d[scord];
                b[dcord] = d[scord];
            }
        }
        pos += w;
    }
}
开发者ID:GoBudokai,项目名称:ozifi,代码行数:34,代码来源:thumb_generator.cpp


示例2: FITS_tutorial3

// Open a FITS file and retrieve the first plane of the image array 
// as a TImage object
void FITS_tutorial3()
{
   printf("\n\n--------------------------------\n");
   printf("WELCOME TO FITS tutorial #3 !!!!\n");
   printf("--------------------------------\n");
   printf("We're gonna open a FITS file that contains several image\n");
   printf("extensions. The primary HDU contains no data.\n");
   printf("Data copyright: NASA\n\n");
   
   if (!gROOT->IsBatch()) {
      //printf("Press ENTER to start..."); getchar();
   }
   
   // Open extensions 1 to 5 from file
   //printf("Press ENTER to see a canvas with all images within the file:"); getchar();
   
   TCanvas *c = new TCanvas("c1", "FITS tutorial #1", 800, 700);
   c->Divide(2,3);
   for (int i=1; i <= 5; i++) {
      TFITSHDU *hdu = new TFITSHDU("sample3.fits", i);
      if (hdu == 0) {
         printf("ERROR: could not access the HDU\n"); return;
      }
      
      TImage *im = hdu->ReadAsImage(0);
      c->cd(i);
      im->Draw();
      delete hdu;
   }
}
开发者ID:adevress,项目名称:root-1,代码行数:32,代码来源:FITS_tutorial3.C


示例3: hist_to_png_h1

void hist_to_png_h1(TH1F * h_c, TH1F* h_e, TH1F* h_f, TString saveTitle, TString type_string)
{
  TCanvas *cPNG = new TCanvas(saveTitle,"",700,500);
  TImage *img = TImage::Create();
  char * type = type_string.Data();
  gStyle->SetOptStat(0);
  gPad->SetLogy();
  auto legend = new TLegend(0.7,0.7,0.9,0.9);
  legend->SetTextSize(0.06);
  legend->AddEntry(h_c,"CEMC","l");
  legend->AddEntry(h_e,"EEMC","l");
  legend->AddEntry(h_f,"FEMC","l");
  
  if(strcmp(type,"spatial")==0)
    {  
      h_e->GetXaxis()->SetTitle("Extrapolation distance from cluster [cm]");
      h_e->GetYaxis()->SetTitle("Counts");
    }
  h_e->Draw();
  h_c->Draw("SAME");
  h_f->Draw("SAME");
  legend->Draw();
  img->FromPad(cPNG);
  img->WriteImage(saveTitle);
}
开发者ID:sPHENIX-Collaboration,项目名称:analysis,代码行数:25,代码来源:track2cluster_plot.C


示例4: draw

void draw( const TImage aImg, const double& aMaxValue, std::string aBasename) 
{
  typedef typename TImage::Domain::ConstIterator ConstIteratorOnPoints; 
  typedef typename TImage::Domain::Point Point; 
  HueShadeColorMap<double, 2> colorMap(0,aMaxValue);

  Board2D b; 
  b.setUnit ( LibBoard::Board::UCentimeter );
 
  for (ConstIteratorOnPoints it = aImg.domain().begin(), itEnd = aImg.domain().end();
       it != itEnd; ++it)
    {
      Point p = *it; 
      b << CustomStyle( p.className(), new CustomFillColor( colorMap( aImg(p) ) ) );
      b << p;
    }

  {
    std::stringstream s; 
    s << aBasename << ".eps"; 
    b.saveEPS(s.str().c_str());
  }
  #ifdef WITH_CAIRO
  {
    std::stringstream s; 
    s << aBasename << ".png"; 
    b.saveCairo(s.str().c_str(), Board2D::CairoPNG);
  }
  #endif
} 
开发者ID:Victor-Ostromoukhov,项目名称:DGtal,代码行数:30,代码来源:exampleFMM2D.cpp


示例5: getFileServer

vtkImageData* CImageLoader::load( std::string sFilename, TImagePtr& imagePtr )
{
	cerr << "Loading data... ";
	TDataFile theData = getFileServer().loadDataSet( sFilename );
	if ( theData.first->getType() == typeid( short ) )
	{
		imagePtr = static_pointer_cast<TImage>( theData.first );
		cerr << "Correct" << endl;
	}
	else
		cerr << theData.first->getType().name() << endl;
	cerr << "done" << endl;
	cerr << "Starting conversion... ";
	// Create vtk structured points structure
  vtkImageData* sp = vtkImageData::New();
  sp->SetDimensions( theData.first->getExtent(0), theData.first->getExtent(1), theData.first->getExtent(2) );
  sp->AllocateScalars();	
  // Assign dataset to structured points
  vtkPointData *p=sp->GetPointData();
	vtkShortArray* sArray = NULL;
	vtkDoubleArray* fArray = NULL;
	TField* floatSet = dynamic_cast<TField*>( theData.first.get() );	
	if ( floatSet != NULL )
	{
		fArray = vtkDoubleArray::New();
		fArray->SetArray(floatSet->getArray(),
			theData.first->getExtent(0)*theData.first->getExtent(1)*theData.first->getExtent(2), 1 );
		p->SetScalars( fArray );
		sp->SetScalarTypeToDouble();
	}
	else 
	{
		TImage* shortSet = dynamic_cast<TImage*>( theData.first.get() );
		if ( shortSet != NULL )
		{
			short* sA = new short[theData.first->getExtent(0)*theData.first->getExtent(1)*theData.first->getExtent(2)];
			short* sAs = sA;
			for( TImage::iterator it = shortSet->begin(); it != shortSet->end(); ++it, ++sAs )
				*sAs = *it;
			sArray = vtkShortArray::New();
			sArray->SetArray( sA,
				theData.first->getExtent(0)*theData.first->getExtent(1)*theData.first->getExtent(2), 1 );
			p->SetScalars( sArray );
			sp->SetScalarTypeToShort();
		}		
		else
		{
	    sp->Delete();		
			throw( FileException( "CVTkHandler - Unknown image format in dataset. Image was not saved" ) );
		}
	}
	sp->UpdateData();
	sp->SetSpacing( 1.0, 1.0, 1.0 );
	sp->SetOrigin( static_cast<double>( theData.first->getExtent(0) )/ 2.0, 
		static_cast<double>( theData.first->getExtent(1) )/ 2.0,
		static_cast<double>( theData.first->getExtent(2) )/ 2.0	);
	cerr << sp->GetNumberOfScalarComponents() << endl;
	cerr << "done" << endl;	
	return sp;
}
开发者ID:BackupTheBerlios,项目名称:aips-svn,代码行数:60,代码来源:cimageloader.cpp


示例6: img2pad

void img2pad()
{
   // Display image in canvas and pad.
   //Author: valeriy Onuchin
   
   TImage *img = TImage::Open("rose512.jpg");
   if (!img) {
      printf("Could not create an image... exit\n");
      return;
   }
   img->SetConstRatio(kFALSE);
   img->Draw("N");

   TCanvas *c = gROOT->GetListOfCanvases()->FindObject("rose512jpg");
   c->SetFixedAspectRatio();

   TCanvas *c = new TCanvas("roses", "roses", 800, 800);
   img->Draw("T100,100,yellow");
   //img->Draw("T100,100,#556655");
   //img->Draw("T100,100");

   TImage *i1 = TImage::Open("rose512.jpg");
   i1->SetConstRatio(kFALSE);
   i1->Flip(90);
   TImage *i2 = TImage::Open("rose512.jpg");
   i2->SetConstRatio(kFALSE);
   i2->Flip(180);
   TImage *i3 = TImage::Open("rose512.jpg");
   i3->SetConstRatio(kFALSE);
   i3->Flip(270);
   TImage *i4 = TImage::Open("rose512.jpg");
   i4->SetConstRatio(kFALSE);
   i4->Mirror(kTRUE);

   float d = 0.40;
   TPad *p1 = new TPad("i1", "i1", 0.05, 0.55, 0.05+d*i1->GetWidth()/i1->GetHeight(), 0.95);
   TPad *p2 = new TPad("i2", "i2", 0.55, 0.55, 0.95, 0.55+d*i2->GetHeight()/i2->GetWidth());
   TPad *p3 = new TPad("i3", "i3", 0.55, 0.05, 0.55+d*i3->GetWidth()/i3->GetHeight(), 0.45);
   TPad *p4 = new TPad("i4", "i4", 0.05, 0.05, 0.45, 0.05+d*i4->GetHeight()/i4->GetWidth());

   p1->Draw();
   p1->cd();
   i1->Draw();
   c->cd();

   p2->Draw();
   p2->cd();
   i2->Draw();
   c->cd();

   p3->Draw();
   p3->cd();
   i3->Draw();
   c->cd();

   p4->Draw();
   p4->cd();
   i4->Draw();
   c->cd();
}
开发者ID:My-Source,项目名称:root,代码行数:60,代码来源:img2pad.C


示例7: psview

void psview()
{
   // set to batch mode -> do not display graphics
   gROOT->SetBatch(1);

   // create a PostScript file
   TString dir = gROOT->GetTutorialDir();
   dir.Append("/graphics/feynman.C");
   gROOT->Macro(dir);
   gPad->Print("feynman.eps");

   // back to graphics mode
   gROOT->SetBatch(0);

   // create an image from PS file
   TImage *ps = TImage::Open("feynman.eps");

   if (!ps) {
      printf("GhostScript (gs) program must be installed\n");
      return;
   }

   new TCanvas("psexam", "Example how to display PS file in canvas", 600, 400);
   TLatex *tex = new TLatex(0.06,0.9,"The picture below has been loaded from a PS file:");
   tex->Draw();

   TPad *eps = new TPad("eps", "eps", 0., 0., 1., 0.75);
   eps->Draw();
   eps->cd();
   ps->Draw("xxx");
}
开发者ID:davidlt,项目名称:root,代码行数:31,代码来源:psview.C


示例8: SaveOpenSpectras

void SaveOpenSpectras() {
	char *spectra_names[] =
		{"CB-Spectra",
		 "TAPS-BaF2-Spectra",
		 "TAPS-PbWO4-Spectra",
		 "TAPS-Veto-Spectra",
		 "Tagger-Spectra",
		 "EPT-Spectra",
		 "PID-Spectra",
		 "MWPC-Spectra",
		 "Scaler-Spectra", // aka trigger spectra...
		 "Livetimes-Spectra",
		 "Physics-Spectra",
		 0};

	// clean up directory...
	printf("\nDelete all PNG images on daq-master:/home/a2cb/OnlineSpectra\n");
	stringstream CmdStr;
	CmdStr << "rm /home/a2cb/acqu/OnlineSpectra/*.png";
	system(CmdStr.str().c_str());

	// prepare elog command, note the blank space at every line!
	stringstream elog_cmd;
	elog_cmd << "echo Run " << gAR->GetRunNumber() << " Online Spectra | ";
	elog_cmd << "elog -h elog.office.a2.kph -u a2online a2messung ";
	elog_cmd << "-l 'Main Group Logbook' -a Experiment='EPT test 2014-07' ";
	elog_cmd << "-a Author='PLEASE FILL IN' -a Type=Routine ";
	elog_cmd << "-a Subject='Online Spectra Run " << gAR->GetRunNumber() << "' ";
	
	// Save Spectra
	UInt_t i = 0;
	char spectra_title[50];
	char spectra_filename[100];
	
	while (spectra_names[i]){
		sprintf(spectra_title, "%s", spectra_names[i]);
		sprintf(spectra_filename, "/home/a2cb/acqu/OnlineSpectra/%02i_%s.png", i, spectra_names[i]);
		gSystem->ProcessEvents();

		if (gROOT->FindObject(spectra_title)) {

			TImage *img = TImage::Create();
			img->FromPad((TVirtualPad*)gROOT->FindObject(spectra_title));
			img->WriteImage(spectra_filename);
			delete img;
			elog_cmd << "-f " << spectra_filename << " ";
			printf("Spectra saved: %s\n", spectra_title);
		} else {
			printf("Spectra not found: %s\n", spectra_title);
		}
		i++;
	}


	printf("\nPosting all PNG images to the Elog\n");
	system(elog_cmd.str().c_str());
	printf("\nPLEASE EDIT THE ELOG ENTRY TO MAKE IT COMPLETE!\n\n");
}
开发者ID:RoddyMacrae,项目名称:acqu-A2,代码行数:58,代码来源:SaveSpectras.C


示例9: img2pad

void img2pad()
{
   TImage *img = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
   if (!img) {
      printf("Could not create an image... exit\n");
      return;
   }
   img->SetConstRatio(kFALSE);
   img->Draw("N");

   TCanvas *c = (TCanvas *)gROOT->GetListOfCanvases()->FindObject("rose512jpg");
   c->SetFixedAspectRatio();

   TCanvas *c1 = new TCanvas("roses", "roses", 800, 800);
   img->Draw("T100,100,#ffff00");
   /*img->Draw("T100,100,#556655");*/
   /*img->Draw("T100,100");*/

   TImage *i1 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
   i1->SetConstRatio(kFALSE);
   i1->Flip(90);
   TImage *i2 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
   i2->SetConstRatio(kFALSE);
   i2->Flip(180);
   TImage *i3 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
   i3->SetConstRatio(kFALSE);
   i3->Flip(270);
   TImage *i4 = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
   i4->SetConstRatio(kFALSE);
   i4->Mirror(kTRUE);

   float d = 0.40;
   TPad *p1 = new TPad("i1", "i1", 0.05, 0.55, 0.05+d*i1->GetWidth()/i1->GetHeight(), 0.95);
   TPad *p2 = new TPad("i2", "i2", 0.55, 0.55, 0.95, 0.55+d*i2->GetHeight()/i2->GetWidth());
   TPad *p3 = new TPad("i3", "i3", 0.55, 0.05, 0.55+d*i3->GetWidth()/i3->GetHeight(), 0.45);
   TPad *p4 = new TPad("i4", "i4", 0.05, 0.05, 0.45, 0.05+d*i4->GetHeight()/i4->GetWidth());

   p1->Draw();
   p1->cd();
   i1->Draw();
   c1->cd();

   p2->Draw();
   p2->cd();
   i2->Draw();
   c1->cd();

   p3->Draw();
   p3->cd();
   i3->Draw();
   c1->cd();

   p4->Draw();
   p4->cd();
   i4->Draw();
   c1->cd();
}
开发者ID:Y--,项目名称:root,代码行数:57,代码来源:img2pad.C


示例10: updateMask

void CExtractRegion::updateMask( TImage& mask, TImage& work, uint index )
{
	TImage::iterator in = work.begin();
	TImage::iterator out = mask.begin();
	while( in != work.end() )
	{
		if ( (*in) > 0 ) (*out) = index;
		++in; ++out;
	}
}
开发者ID:BackupTheBerlios,项目名称:aips-svn,代码行数:10,代码来源:cextractregion.cpp


示例11: save_image

/**
 * \brief saves the plotted image
 * Saves the plotter image to the given filename
 * \param std::string filename - output filename for the image also determines the image type ( ".png" -> png etc.)
 * \return bool on success
 */
bool Plotter::save_image(std::string filename){
  try{
    TImage *img = TImage::Create();
    img->FromPad(canvas);
    img->WriteImage(filename.c_str());
    return true;
  }catch(std::runtime_error &e){
    std::cerr << e.what() << std::endl;
    return false;
  }
}
开发者ID:wutzi15,项目名称:plot_lib,代码行数:17,代码来源:plot_lib.cpp


示例12: computeSize

ulong CExtractRegion::computeSize( TImage& region )
{
	ulong size = 0;
	TImage::iterator in = region.begin();
	while( in != region.end() )
	{
		if ( (*in) > 0 ) size++;
		++in;
	}	
	return size;
}
开发者ID:BackupTheBerlios,项目名称:aips-svn,代码行数:11,代码来源:cextractregion.cpp


示例13: CtrlAddItemToCoolBarList_Image

//添加Image控件到CoolBarList, 
// pszString必须是动态的(非Static)
// nWidth 为0 -- 自动长度
Int32 CtrlAddItemToCoolBarList_Image(TWindow*pWin,  TBarListItem* pListItem, Coord nX, Coord nY, Coord nWidth, Int32 nHeight, TBitmap * pBmp)
{
	TRectangle obBtnRec(0,0,0,0);
	Int32 nImageId = pListItem->AddCtrl(CTL_CLASS_IMAGE, 0, 0);
	TImage* pImage = static_cast<TImage*>(pWin->GetControlPtr(nImageId));

	obBtnRec.SetRect(nX, nY, nWidth, nHeight);
	pImage->SetBounds(&obBtnRec);
	pImage->SetBitmap(pBmp);
	pImage->SetEnabled(TRUE);
	return nImageId;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:15,代码来源:gui_common.cpp


示例14: FinishVertex

  void FinishVertex(VertexDescriptorType target, VertexDescriptorType sourceNode)
  {
    //OutputHelpers::WriteImage(MaskImage, Helpers::GetSequentialFileName("mask", this->NumberOfFinishedVertices, "png"));
    ITKHelpers::WriteImage(MaskImage, Helpers::GetSequentialFileName("mask",
                                                                        this->NumberOfFinishedVertices, "mha"));
    //OutputHelpers::WriteVectorImageAsRGB(Image, Helpers::GetSequentialFileName("output", this->NumberOfFinishedVertices, "png"));
    ITKHelpers::WriteImage(Image, Helpers::GetSequentialFileName("output",
                                                                    this->NumberOfFinishedVertices, "mha"));

    ITKHelpers::WriteRGBImage(Image, Helpers::GetSequentialFileName("output",
                                                                    this->NumberOfFinishedVertices, "png"));

    typename TImage::PixelType holeColor;
    holeColor.SetSize(Image->GetNumberOfComponentsPerPixel());
    holeColor[0] = 255;
    holeColor[1] = 0;
    holeColor[2] = 0;

    MaskOperations::WriteMaskedRegionPNG(Image, MaskImage, Image->GetLargestPossibleRegion(), Helpers::GetSequentialFileName("maskedOutput", this->NumberOfFinishedVertices, "png"),
                       holeColor);


    typedef itk::Image<unsigned char, 2> IndicatorImageType;

    IndicatorImageType::Pointer boundaryStatusMapImage = IndicatorImageType::New();
    boundaryStatusMapImage->SetRegions(Image->GetLargestPossibleRegion());
    boundaryStatusMapImage->Allocate();
//     BoostHelpers::WritePropertyMapAsImage(BoundaryStatusMap, boundaryStatusMapImage.GetPointer(),
//                                           Helpers::GetSequentialFileName("boundaryStatusMap",
//                                           this->NumberOfFinishedVertices, "png"));

    IndicatorImageType::Pointer validBoundaryNodeImage = IndicatorImageType::New();
    validBoundaryNodeImage->SetRegions(Image->GetLargestPossibleRegion());
    validBoundaryNodeImage->Allocate();
//     BoostHelpers::WriteValidQueueNodesAsImage(BoundaryNodeQueue, BoundaryStatusMap,
//                                                 validBoundaryNodeImage.GetPointer(),
//                                           Helpers::GetSequentialFileName("boundaryQueueValidNodes",
//                                                this->NumberOfFinishedVertices, "png"));

    IndicatorImageType::Pointer allBoundaryNodeImage = IndicatorImageType::New();
    allBoundaryNodeImage->SetRegions(Image->GetLargestPossibleRegion());
    allBoundaryNodeImage->Allocate();
//     BoostHelpers::WriteAllQueueNodesAsImage(BoundaryNodeQueue, allBoundaryNodeImage.GetPointer(),
//                                           Helpers::GetSequentialFileName("boundaryQueueAllNodes",
//                                            this->NumberOfFinishedVertices, "png"));

    this->NumberOfFinishedVertices++;

    // std::cout << "Finished node " << this->NumberOfFinishedVertices << std::endl;

  }
开发者ID:nocnokneo,项目名称:PatchBasedInpainting,代码行数:51,代码来源:DebugVisitor.hpp


示例15: SaveImage

// store image inside png
void SaveImage(const TImage& image, const string& destFile) {
    vector<unsigned char> result(image.width() * image.height() * 4);
    unsigned char* d;
    const unsigned char* r = image.data(0, 0, 0, 0);
    const unsigned char* g = image.data(0, 0, 0, 1);
    const unsigned char* b = image.data(0, 0, 0, 2);
    int sp = image.spectrum();
    if (sp == 4) {
        const unsigned char* a = image.data(0, 0, 0, 3);
        for (d = result.data(); d < result.data() + result.size();) {
            *(d++) = *(r++);
            *(d++) = *(g++);
            *(d++) = *(b++);
            *(d++) = *(a++);
        }
    } else if (sp == 3) {
        for (d = result.data(); d < result.data() + result.size();) {
            *(d++) = *(r++);
            *(d++) = *(g++);
            *(d++) = *(b++);
            *(d++) = 255;
        }
    } else {
        throw UException("failed to save image - wrong type");
    }
    size_t err = lodepng::encode(destFile, result, image.width(), image.height());
    if (err) {
        throw UException(lodepng_error_text(err));
    }
}
开发者ID:GoBudokai,项目名称:ozifi,代码行数:31,代码来源:thumb_generator.cpp


示例16: pad2png

void pad2png()
{
   TCanvas *c = new TCanvas;
   TH1F *h = new TH1F("gaus", "gaus", 100, -5, 5);
   h->FillRandom("gaus", 10000);
   h->Draw();

   gSystem->ProcessEvents();

   TImage *img = TImage::Create();

   img->FromPad(c);

   img->WriteImage("canvas.png");
}
开发者ID:MycrofD,项目名称:root,代码行数:15,代码来源:pad2png.C


示例17: Subtract

void
Subtract( TImage &aImage1, TImage &aImage2 )
{
	if ( aImage1.GetSize() != aImage2.GetSize() ) {
		_THROW_ ErrorHandling::EBadParameter(":hl:");
	}
	typename TImage::Iterator it1 = aImage1.GetIterator();
	typename TImage::Iterator it2 = aImage2.GetIterator();

	while ( it1 != it1.End() &&  it2 != it2.End() ) {
		*it1 = Abs(*it1 - *it2);
		++it1;
		++it2;
	}
}
开发者ID:JanKolomaznik,项目名称:MedV4D,代码行数:15,代码来源:Subtract.cpp


示例18: computerBasicNormalsFromHeightField

void 
computerBasicNormalsFromHeightField(const TImage &anHeightMap, TImageVector &vectorField)
{
  for(typename TImage::Domain::ConstIterator it = anHeightMap.domain().begin(); 
      it != anHeightMap.domain().end(); it++){
    if(anHeightMap.domain().isInside(*it+Z2i::Point::diagonal(1))&&
       anHeightMap.domain().isInside(*it-Z2i::Point::diagonal(1))){
      double dx = (anHeightMap(*it-Z2i::Point(1,0))-anHeightMap(*it+Z2i::Point(1,0)))/2.0;
      double dy = (anHeightMap(*it-Z2i::Point(0,1))-anHeightMap(*it+Z2i::Point(0,1)))/2.0;
      Z3i::RealPoint n (dx, dy, 1);
      n /= n.norm();
      vectorField.setValue(*it,n);
    }
  }
}
开发者ID:jlevallois,项目名称:DGtalTools,代码行数:15,代码来源:heightfield2shading.cpp


示例19: hist_to_png

void hist_to_png(TH2F * h, TString saveTitle, TString type_string)
{
  TCanvas *cPNG = new TCanvas(saveTitle,"",700,500);
  TImage *img = TImage::Create();
  char * type = type_string.Data();
  gPad->SetLogz();
  gStyle->SetOptStat(0);
  if(strcmp(type,"phi")==0)
    {
      h->GetXaxis()->SetTitle("Track Phi");
      h->GetYaxis()->SetTitle("Cluster Phi");
    }
  else if(strcmp(type,"eta")==0)
    {
      h->GetXaxis()->SetTitle("Track Eta");
      h->GetYaxis()->SetTitle("Cluster Eta"); 
    }
  else if(strcmp(type,"theta")==0)
    {
      h->GetXaxis()->SetTitle("Track Theta");
      h->GetYaxis()->SetTitle("Cluster Theta");
    }
  else if(strcmp(type,"mom")==0)
    {
      h->GetXaxis()->SetTitle("Track Momentum [GeV]");
      h->GetYaxis()->SetTitle("Cluster Momentum [GeV]");
    }
  else if(strcmp(type,"posx")==0)
    {
      h->GetXaxis()->SetTitle("Track Position X [cm]");
      h->GetYaxis()->SetTitle("Cluster Position X [cm]");
    }
  else if(strcmp(type,"posy")==0)
    {
      h->GetXaxis()->SetTitle("Track Position Y [cm]");
      h->GetYaxis()->SetTitle("Cluster Position Y [cm]");
    }
  else if(strcmp(type,"posz")==0)
    {  
      h->GetXaxis()->SetTitle("Track Position Z [cm]");
      h->GetYaxis()->SetTitle("Cluster Position Z [cm]");
    }
  h->Draw("colz9");
  img->FromPad(cPNG);
  img->WriteImage(saveTitle);

  delete img;
}
开发者ID:sPHENIX-Collaboration,项目名称:analysis,代码行数:48,代码来源:track2cluster_plot.C


示例20: getImage

static QImage 
getImage(const TImage &anImage, double gridSize=1.0 ){
  typedef ConstImageAdapter<TImage, typename TImage::Domain, 
                            functors::BasicDomainSubSampler<typename TImage::Domain, int, double>,  
                            typename TImage::Value,
                            functors::Identity > ConstImageAdapterForSubSampling;
  
  std::vector<double> scales;
  scales.push_back(gridSize);
  scales.push_back(gridSize);
  
  functors::BasicDomainSubSampler<typename TImage::Domain, int, double> subSampler (anImage.domain(), scales, Z2i::Point(0,0)); 
  typename TImage::Domain newDomain = subSampler.getSubSampledDomain();
  functors::Identity id;
  ConstImageAdapterForSubSampling  scaledImage (anImage, newDomain, subSampler, id ); 
  
  unsigned int height = scaledImage.domain().upperBound()[1]+1;
  unsigned int width = scaledImage.domain().upperBound()[0]+1;
  uchar * data = new uchar [height*width*4];
  for(unsigned int i=0; i<height; i++){
    for(unsigned int j=0; j<width; j++){
      data[(j+width*i)*4]=scaledImage(Z2i::Point(j,i));
      data[(j+width*i)*4+1]=scaledImage(Z2i::Point(j,i));
      data[(j+width*i)*4+2]=scaledImage(Z2i::Point(j,i));
      data[(j+width*i)*4+3]=scaledImage(Z2i::Point(j,i));
    }
  }
   QImage result(  data, width,  height, QImage::Format_RGB32 );
   return result;
}
开发者ID:fabienbaldacci,项目名称:DGtalTools,代码行数:30,代码来源:sliceViewer.cpp



注:本文中的TImage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TInetAddr类代码示例发布时间:2022-05-31
下一篇:
C++ TIXML_STRING类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap