Exemplo n.º 1
0
void MainViewer::setImgData(std::string fName)
{
    // set img data
    if (!nii_img)
    {
        nii_img = new NiiLoader(fName.c_str());
        setImgData(nii_img);
    }
    else
    {
        std::cout<<"Warning: image data ptr isn't null\n";
    }
}
Exemplo n.º 2
0
ImageSlice::ImageSlice(vtkSmartPointer<vtkImageData> data, std::string orient, vtkSmartPointer<vtkRenderer> mainWin_renderer, bool img)
{
    setImgData(data);
    setOrient(orient);
    setRenderer(mainWin_renderer);

    if (img) 
   {
        setImgCamera();
        setParallel(true);
    }
    else 
    {
        setParallel(false);
        renderer->ResetCamera();
    }
}
Exemplo n.º 3
0
IplImage* FeatPyramid::resize (const IplImage *mxsrc, const float mxscale)
{
  float *src = getImgData <float> (mxsrc);
  int sdims[3];
	getDimensions(mxsrc, sdims);
  float scale = mxscale;

  if (scale > 1.0)
    cout << "Invalid scaling factor" << endl;

  int ddims[3];
  ddims[0] = (int)round(sdims[0]*scale);
  ddims[1] = (int)round(sdims[1]*scale);
  ddims[2] = sdims[2];

  assert (ddims[0] > 0);
  assert (ddims[1] > 0);
  CvSize size = cvSize(ddims[1], ddims[0]);
  IplImage *mxdst = cvCreateImage (size, IPL_DEPTH_32F, 3);
  assert (mxdst != NULL);

  assert (ddims[2] > 0);
  float *dst = new float [ddims[0] * ddims[1] * ddims[2]];
  assert (dst != NULL);
  for (int l = 0; l < ddims[0] * ddims[1] * ddims[2]; l++)
    dst[l] = 0;

  assert (sdims[1] > 0);
  assert (sdims[2] > 0);
  float *tmp = new float [ddims[0] * sdims[1] * sdims[2]];
  assert (tmp != NULL);
  for (int l = 0; l < ddims[0] * sdims[1] * sdims[2]; l++)
    tmp[l] = 0;

  resize1dtran(src, sdims[0], tmp, ddims[0], sdims[1], sdims[2]);
  resize1dtran(tmp, sdims[1], dst, ddims[1], ddims[0], sdims[2]);

  setImgData (mxdst, dst);

	delete[] src;
  delete[] dst;
  delete[] tmp;

  return mxdst;
}