// OMERO_C++_Test.cpp : Defines the entry point for the console application. // // Domain #include #include #include #include #include #include #include #include #include // Std #include #include #include #include #include #include using namespace std; int main(int argc, char* argv[]) { long pixId = 1; //cout<<"Hello World\n"<createSession("root", "omero"); } catch (const Glacier2::CannotCreateSessionException& ccse) { printf("ERROR: omero->createSession();\n"); } try { pixelsService = sf->getPixelsService(); } catch (const omero::ServerError& serverError) { printf("ERROR: %s\n", serverError.message); printf("ERROR: sf->getPixelsService();\n"); } catch (const Ice::LocalException& localException) { localException.ice_print(cout); printf("\nERROR: sf->getPixelsService();\n"); } try { gateway = sf->createGateway(); } catch (const omero::ServerError& serverError) { printf("ERROR: %s\n", serverError.message); printf("ERROR: sf->createGateway();\n"); } catch (const Ice::LocalException& localException) { localException.ice_print(cout); printf("\nERROR: sf->createGateway();\n"); } /*try { omero::model::ImagePtr img = gateway->getImage(pixId); } catch (const omero::ServerError& serverError) { printf("ERROR: %s\n", serverError.message); printf("ERROR: gateway->getImage();\n"); } catch (const Ice::LocalException& localException) { localException.ice_print(cout); printf("\nERROR: gateway->getImage();\n"); }*/ try { pixelsObject = gateway->getPixels(pixId); } catch (const omero::ServerError& serverError) { printf("ERROR: %s\n", serverError.message); printf("ERROR: gateway->getPixels();\n"); } catch (const Ice::LocalException& localException) { localException.ice_print(cout); printf("\nERROR: gateway->getPixels();\n"); } if (!pixelsObject) { // is null printf("ERROR: pixelsObject is NULL!\n"); } omero::api::RawPixelsStorePrx rawPixelsStore = sf->createRawPixelsStore(); rawPixelsStore->setPixelsId(pixId, false); omero::api::ServiceList services; services.push_back(rawPixelsStore); services.push_back(pixelsService); sf->keepAllAlive(services); int xdim = pixelsObject->getSizeX()->getValue(); int ydim = pixelsObject->getSizeY()->getValue(); int zdim = pixelsObject->getSizeZ()->getValue(); cout << "The image " << pixId << " is: " << xdim << "x" << ydim << "x" << zdim << endl; int cdim = pixelsObject->getSizeC()->getValue(); int tdim = pixelsObject->getSizeT()->getValue(); cout << "The image " << pixId << " has: " << cdim << " colors and " << tdim << " timesteps" << endl; double xphysize = pixelsObject->getPhysicalSizeX()->getValue(); double yphysize = pixelsObject->getPhysicalSizeY()->getValue(); double zphysize = pixelsObject->getPhysicalSizeZ()->getValue(); cout << "Physical Size x: " << xphysize << " y: " << yphysize << " z: " << zphysize << endl; for(int z=0; zgetPlane(z,c,t); for(int x=0; xcloseSession(); system("pause"); return 0; }