コード例 #1
0
ファイル: ecat7img.cpp プロジェクト: phoboz/volkit
int Ecat7Img::open(const char *fname)
{
    if(!fname)
    {
        statmsg = imgmsg[1];
        return 1;
    }

    // Open file for read
    fp = fopen(fname, "rb");
    if (!fp)
    {
        statmsg = imgmsg[3];
        return 1;
    }
    fileOpen = true;

    // Read header
    if (readMainHeader() > 0)
    {
        close();
        return 1;
    }

    // Read matrix list
    if (readMatrixList() > 0)
    {
        close();
        return 1;
    }

    // Calculate number of planeNr, frameNr
    if (calculateNr() > 0)
    {
        close();
        return 1;
    }

    // Read subheader and calculate xSize, ySize, zSize and pxlNr
    if (readSubHeader() > 0)
    {
        close();
        return 1;
    }

    if (alloc(planeNr, xSize, ySize) > 0)
    {
        statmsg = imgmsg[2];
        close();
        return 1;
    }

    // Copy information from mainheader
    headerToImg();

    // Set file format
    setFileFormat();

    return 0;
}
コード例 #2
0
    void IoDisk::setup(const StringMap & settings)
    {
        Io::setup(settings);
        
        // --------------------------
        // Get name from instance
        
        std::string instanceName = settings.at("name");
        setInstanceName(instanceName);

        // --------------------------
        // Check if need to draw timestamp
        
        bool drawTimestamp = (settings.at("ios.Disk.markWithTimestamp") == "true");
        setDrawTimestamp(drawTimestamp);
        cv::Scalar color = getColor(settings.at("ios.Disk.timestampColor"));
        setTimestampColor(color);
        
        std::string timezone = settings.at("timezone");
        std::replace(timezone.begin(), timezone.end(), '-', '/');
        std::replace(timezone.begin(), timezone.end(), '$', '_');
        setTimezone(timezone);
        
        // -------------------------------------------------------------
        // Filemanager is mapped to a directory and is used by an image
        // to save to the correct directory.
        
        setFileFormat(settings.at("ios.Disk.fileFormat"));
        m_fileManager.setBaseDirectory(settings.at("ios.Disk.directory"));
    }
コード例 #3
0
ファイル: IoDisk.cpp プロジェクト: cgsalvador/machinery
 void IoDisk::setup(const StringMap & settings)
 {
     Io::setup(settings);
     
     // --------------------------
     // Get name from instance
     
     std::string instanceName = settings.at("name");
     setInstanceName(instanceName);
     
     // -------------------------------------------------------------
     // Filemanager is mapped to a directory and is used by an image
     // to save to the correct directory.
     
     setFileFormat(settings.at("ios.Disk.fileFormat"));
     m_fileManager.setBaseDirectory(settings.at("ios.Disk.directory"));
 }