Specifying byte stream type for Read File with Type Descriptor

Hi.
I'm trying to write a VI that reads an image file format that can have
different datatypes. What I have so far is that I open the file, read
the header, and get the width, height, number of frames, and datatype.
I calculate number of pixels by nrows*ncols*nframes with no problem,
but I'm not sure how to tell Read File the correct datatype to read
the data into.
I tried using a Case structure where I have a Read File in each case
with the correct type constant as input for that case. The problem is
that the tunnel graduates the datatype to the highest representation.
I found in Application Note 154 the discussion about Type Descriptors.
Is there a way to generate a Type Descriptor and output it from a C
ase
structure? I tried just returning the value (e.g. 0x0402 for a Word),
but Read File will just see that the byte stream type is a uint32.
Is there any other way to do this?
Thanks for any help.

I converted the code to LabVIEW 6.1 for you and attached it below.
Don't worry about being a newbie. We all start there. Keep asking this type of question and you won't stay there long.
As you are discovering, being strictly typed means that you must rewrite code even for a simple data type change, or convert everything to the same data type first. For image data, conversion can result in a lot of extra space being wasted. Use a modified version of the GLV_WaveformBuffer.vi to hold your data. Use the array functions, which operate inline, to add to and delete the data wires in the buffer. This allows you to save several different data types. You will need several different inputs and outputs to handle these data types. I ha
ve also attached a similar file created for exactly the problem you have - storing arrays of different data types (data from NI-SCOPE devices, in this case - can be float, I8, I16, or I32).
Routines that take any type work in one of two ways. LabVIEW primitives, such as plus and minus operators, work by figuring out the type and doing the right thing in the C code layer of the LabVIEW environment. Users of LabVIEW can't do this. Users can make polymorphic VIs. Polymorphic VIs are actually a single VI for every data type that are referenced by a "wrapper", the polymorphic VI. Users still need to write a different VI for every data type they need.
Take home message - if you need to work with different data types, you will need to rewrite your code for every data type or convert your data to a common data type. Polymorphic VIs and case statements are your friend.
Let me know if you need more help.
This account is no longer active. Contact ShadesOfGray for current posts and information.
Attachments:
GigaLabVIEW61.zip ‏362 KB
sfpScpChan_Waveform_Buffer.zip ‏74 KB

Similar Messages

  • How to define "byte stream type" for "open file"?

    Hello,
    I created some numbers (type "double") in Matlab and stored in a file. What value should I use to specify the "byte stream type" for "open file" in Labview? Should I put something like "DBL" or "I32". I don't know where to find the list of legal "types" in Labiew help.
    Thanks so much!
    Felicia

    Looks like 7.1:
    The Matlab "double" is 64 bits (8 bytes). It doesn't make much sense to use an integer datatype to read a floating point value, so you would use DBL in LabVIEW. The numeric data types table can be found here.
    By the way, this assumes you saved the file as raw binary, as opposed to a .mat file, which is something different.
    Message Edited by smercurio_fc on 08-08-2008 11:21 AM
    Attachments:
    read file 7.png ‏13 KB

  • The byte stream type of the given URL is unsupported

    I'm trying to open .ses files in Audition CC that were created in Audition 3.0 and I get the error "The byte stream type of the given URL is unsupported" and nothing loads.
    What is going on?  The wave files are in a different folder but shouldn't the program ask me where to find them?

    I think the link got munged!
    Let's try again: http://www.aatranslator.com.au/ses2sesx.html
    It appears that the Insert Web link screen in this software was adding an additional https:// at the end of the link!  Hope this one works!

  • How can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,-

    how can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,…"

    It sounds like if you open Preferences in Word there will be a place where you can specify where to store autorecover files. Right now it sounds like it's pointing to somewhere that doesn't exist.

  • Directory for archiving files with errors

    HI ,
    My Scenario is file to RFC Asynch.
    when ever the PI picks file from the source directory that file need to delete from the path and need to be archived to some other patch.
    And if the file has wrong data it need to archive to error archive folder.
    For this I used  Archive processing in filesender adapter and I also used directory for archiving files with errors(for wrong data files).
    Now the files are arching successfully in the given archive folder for successful messages. But the error files (wrong data which are throwing mapping error in MONI) are also archiving in the same archive folder.
    But these error files need to archive in error archive folder.
    How can I achieve this?
    Thanks in Adv..
    Vankadoath.

    you can use raja's logic ..........in addition in second receiver do a simple mapping UDF to delete the file from the SUCCESS folder. otherwise your file will be archived in both the folder success and errror
    see this code.
    DynamicConfiguration conf = (DynamicConfiguration) para.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
                   DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
                         inputFileName = conf.get(keyFileName1);
      *File f1 = new File("/usr/sap/XX/"+keyFileName1);*
      *boolean success = f1.delete();*
      *if (!success){*
      *System.out.println("Deletion failed.");*
      *System.exit(0);*
      *}else{*
      *System.out.println("File deleted.");*

  • Used to convert all my videos into iPhone mp4 format using Any Video Converter - then add it to my iPhone 3GS. But last few days, I cant add video files to iTunes. and the iTunes doesnt even specify the reason except for that "files are not supported"

    Everyting was perfect earlier. Used to convert all my videos into iPhone mp4 format using Any Video Converter - then add it to my iPhone 3GS. But last few days, I cant add video files to iTunes. and the iTunes doesnt even specify the reason except for that "files are not supported"
    Everything is fine.
    -They are the right format
    -Quicktime is updated
    -I have tried simply dragging them into the 'movie' library
    -I have tried going to file<add file to library
    Nothing works, has anyone else had this problem and found a way around it?
    Any and all help appreciated.

    In addition to Mike's suggestions,  you only have 4GB of RAM and Mavericks does use more RAM than other versions. You may also want to look at the apps that startup on login and the possiblity of upgrading RAM.

  • Search for a file with part of a filename in a given folder.

    How can I search for a file with part of a filename in a given folder?
    Or can I change the columns in Advanced Search so that the heading is filename?

    thanks, Michel. it had occurred to me to put a scratch tag on the folder, but I was hoping for an easier way. in future I'll do as you suggest though, because it's easier than what I have been doing.
    daryl

  • Important question for reading File

    Good morning
    i need help...
    any one know 1 class for oper all document?
    example:
    http:sitoclient.com/?file?filename.txt
    or
    /home/class/filename.txt
    i need 1 class for open file in all mode
    where is this class?
    one class for read file in url or in absolute path
    Message was edited by:
    mirko81

    ok i know this class but i not know where insert Java.net in my code....
    and i need use class BufferReader for other problem...
    where insert Java.net.URL ??
    String keyCode = "";
    BufferedReader file = new BufferedReader(new FileReader(keyFile));
                   if(file.read() > 0)
                        int i = 0;
                        String appKey = file.readLine();
                        for(i=0;i<500;i++)
                             char c = appKey.charAt(0);
                             if(c==' '| c=='#')
                                  appKey = file.readLine();
                             else
                                  keyCode = keyCode + appKey;
                                  appKey= file.readLine();
                                  char cd = appKey.charAt(0);
                                  if(cd==' '| cd=='#')break;
                   else
                        System.out.println("File corrotto o non presente");
                   }

  • How to read files with codepage UTF16LE with "Sender File Adapter"

    Hi everybody,
    I am using a XI-Filesender-Adapter to get a (UTF-16LE encoded) file und process it in XI-Mapping.
    This is my File-Content:
    Cost Centre,Cost Code,Page Count (B&W),Page Count (Colour),Job Count
    Unknown,Lexmark,"37,480",334,"11,968"
    Unknown,Unknown,312,0,177
    110000,Lexmark,128,228,43
    The HEX-representation of this content is:
    FF FE 43 00 6F 00 73 00 74 00 20 00 43 00 65 00
    (The starting 2 Bytes FF FE represent UTF16-LE )
    And this is the payload I get for mapping:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns:MT_POM_KOSTEN xmlns:ns="http://aua.com/pom">
    <POM_REC>
      <COSTCENTER>uFEFFCost Centre</COSTCENTER>
      <COSTCODE>Cost Code</COSTCODE>
      <PAGECOUNT_BW>Page Count (B&W)</PAGECOUNT_BW>
      <PAGECOUNT_COL>Page Count (Colour)</PAGECOUNT_COL>
      <JOBCOUNT>Job Count</JOBCOUNT>
      </POM_REC>
    <POM_REC>
      <COSTCENTER>Unknown</COSTCENTER>
      <COSTCODE>Lexmark</COSTCODE>
      <PAGECOUNT_BW>37,480</PAGECOUNT_BW>
      <PAGECOUNT_COL>334</PAGECOUNT_COL>
      <JOBCOUNT>11,968</JOBCOUNT>
      </POM_REC>
    <POM_REC>
      <COSTCENTER>Unknown</COSTCENTER>
      <COSTCODE>Unknown</COSTCODE>
      <PAGECOUNT_BW>312</PAGECOUNT_BW>
      <PAGECOUNT_COL>0</PAGECOUNT_COL>
      <JOBCOUNT>177</JOBCOUNT>
      </POM_REC>
    <POM_REC>
      <COSTCENTER>110000</COSTCENTER>
      <COSTCODE>Lexmark</COSTCODE>
      <PAGECOUNT_BW>128</PAGECOUNT_BW>
      <PAGECOUNT_COL>228</PAGECOUNT_COL>
      <JOBCOUNT>43</JOBCOUNT>
      <POM_REC>
    I can see the correct strings (for example Cost Centre) in  payload, but the string-comparison in the user defines function cannot recognize the equality of the strings:
    for (int i =0; i < a.length; i++) {
    if (
       (a<i>.equals("Cost Centre"))  )
      result.addSuppress();
    else
      result.addValue("");
    Actually I am using UTF-8 as codepage in Fileadapter (and Text as type)
    When I try to use UTF16 (or UTF-16LE) as Codepage, I am getting unreadable characters.
    I also tried binary, UTF16-BE,...
    The only way is to covert the file to ANSI before  I use it with XI. Then my function does work correctly.
    Does anybody have an idea, how I can read a UTF16-LE File and process it correctly in XI?
    I am using XI 7.00 0023  and JSDK 1.4.2-34
    Thanks a lot
    Armin

    Hello Armin,
                        I have gone through some SAP notes and blogs  to find solution to your problem, here is what I found
    1. SAP NOTE 821267
    q) How do I correctly configure the File Encoding used by the File
    Adapter?
    Flat Files with File Content Conversion
    For a File Sender channel, configure the encoding of the source
    file. The file will be interpreted according to the configured
    encoding and converted to XML with an UTF-8 encoding.
    For a File Receiver channel, configure the encoding to match
    the encoding you would like to be written to the target flat
    file.
    - Flat Files without File Content Conversion
    Whether to configure an encoding in this case depends on if you
    want to pass through the file "as is", e.g. within a File
    Sender to File Receiver scenario, or if you want to convert the
    file's encoding on its way through the Integration Server. For
    "as is" processing, configure both the sender and the receiver
    using the File Type setting "Binary".
    To apply an encoding conversion, configure the respective
    source and target encoding in both the sender and receiver
    channel.
    Important: Configuring an encoding in the receiver channel
    will only lead to the expected results if the payload sent to
    the receiver channel is in UTF-8 format (e.g., by having
    specified an encoding conversion in the Sender channel).
    So as per this note if you configure the encoding scheme of sender communication channel to UTF-16LE, adapter should be able to convert it to UTF-8 by default. But you have posted that this encoding scheme is leading to unreadable charcters
    2) SAP note 880173
    This speaks of use of module XMLAnonymizerBean which can be applied to XML payload to change its encoding.
    3) How to guide on encoding : http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42?QuickLink=index&overridelayout=true
    4) SAP note:960663
    http://help.sap.com/saphelp_nw04/helpdata/en/45/da2deb47812e98e10000000a155369/content.htm
    TextCodePageConversion Bean details which might solve your problem.
    5) Finally if nothing above works you need  a java mapping code to convert to target XML structure without any File content conversion. The mapping will convert the received file to proper target XML in "UTF-8" encoding. Please let us know if you need help on the code with this final option.
    Regards
    Anupam

  • Invalid Mimetype Detection for .xls file with CF10

    After upgrading to CF10, we are having issues getting our server to properly recognize any mimetype associated with the .xls file extension.  For some odd reason, the server is viewing them as a word file type and rejecting it.   
    When we upload a file with the .xls extension, the server responds back with the following error message:
    "The MIME type or the Extension of the uploaded file application/msword was not accepted by the server. Only files of type application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,appl ication/vnd.openxmlformats-officedocument.spreadsheetml.sheet can be uploaded. Verify that you are uploading a file of the appropriate type. The error type is Application."
    Our only workaround for the time being is uploading all files in the newer .xlsx format, which the server properly accepts.  As you will see from the above error message, those are the mimetypes I have thus far.  The other work around is updating the tika jar files which I have included more details in my bug report link below, but that is a solution we are steering off of until we get further confirmation on the solution. 
    I've reported this possible bug to Adobe, but of course it will be weeks or months before a confirmation or response is made on it since there are countless other bugs / feature requests that are still unanswered.  So I'm reaching out to the community in efforts to see if anyone else may have received the same issue or could see what we may be doing wrong. 
    Link to bug report with more details: https://bugbase.adobe.com/index.cfm?event=bug&id=3343364

    If you guys want to replicate this in your local environment, it's very easy using the steps I outlined in my bug report.  Please report back on your results.  I would love to see if other users experience the same or different.
    Steps to Reproduce:
    1. Create cfset tags to specify what type of files and mime types are allowed for user uploads.
    <cfset uploadFileFilter = ".xls,.xlsx" />
    <cfset uploadFileMimeType = "application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,app lication/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
    2. Define where the file will be uploaded to using the cffile attribute. (Change destination to the same directory of where you are creating the current .cfm file below)
    <cffile action = "upload"
    fileField = "fileupload"
    destination = "C:\test\"
    accept = "#uploadFileMimeType#"
    nameConflict = "MakeUnique">
    3. Finally create a simple form that allows the user to upload files.
    <cfform enctype="multipart/form-data">
    <cfinput accept="#uploadFileMimeType#" type="file" name="FileContents">
    <br/>
    <cfinput type="submit" name="submit" value="Upload File">
    </cfform>
    4. Open excel, enter any data, and save it as an .xls file.
    5. Submit it to the form.
    Final code
    <cfset uploadFileFilter = ".xls,.xlsx" />
    <cfset uploadFileMimeType = "application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,app lication/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
    <cfif isDefined("Form.FileContents") >
        <cffile action = "upload" 
            fileField = "FileContents" 
            destination = "C:\EnterLocalPathHere\" 
            accept = "#uploadFileMimeType#" 
            nameConflict = "MakeUnique">
    <cfelse>
        <cfform enctype="multipart/form-data">
            <cfinput accept="#uploadFileMimeType#" type="file" name="FileContents">
            <br/>
            <cfinput type="submit" name="submit" value="Upload File"> 
        </cfform>
    </cfif>

  • Read file with nio and flush with servlet

    Can I read file, by using java.nio (for example by FileInputStream.getChannel()) and then flush the file content thru the servlet?
    I kwow about reading without java.nio, get a byte array and then flush it by httpservletresponse writer or outputstream, but I wish to know if it is possibile with java.nio reading.
    thanks

    I'm doing it only for file reading..
    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();    
            FileInputStream fis = null;                               
            try
                String path = "/var/hello.txt";
                fis = new FileInputStream(path);       
                FileChannel channel =  fis.getChannel();
                ByteBuffer bb = ByteBuffer.allocate((int) channel.size());
                channel.read(bb);
                byte[] data2 = bb.array();
                channel.close();
                out.write(new String(data2));
            } catch (FileNotFoundException ex)
                ex.printStackTrace();
            } finally
                try
                    fis.close();
                } catch (IOException ex)
    ex.printStackTrace();
                out.close();
        }

  • ORA-09100 specified length too long for its datatype with Usage Tracking.

    Hello Everyone,
    I'm getting an (ORA-09100 specified length too long for its datatype) (a sample error is provided below) when viewing the "Long-Running Queries" from the default Usage Tracking Dashboard. I've isolated the problem to the logical column "Logical SQL" corresponding to the physical column "QUERY_TEXT" in the table S_NQ_ACCT. Everything else is working correctly. The logical column "Logical SQL" is configured as a VARCHAR of length 1024 and the physical column "QUERY_TEXT" is configured as a VARCHAR2 of length 1024 bytes in an Oracle 11g database. Both are the default configurations and were not changed.
    In the the table S_NQ_ACCT we do have record entries in the field "QUERY_TEXT" that are of length 1024 characters. I've tried various configuration such as increasing the the number of bytes or removing any special character but without any sucess. Currently, my only possible workaround is reducing the "Query_Text" data entries to roughly 700 characters. This makes the error go away. Additional point my character set to WE8ISO8859P15.
    - Any suggestions?
    - Has anyone else ever had this problem?
    - Is this potentially an issue with the ODBC drive? If so, why would ODBC not truncate the field length?
    - What is the maximum length supported by BI, ODBC?
    Thanks in advance for everyones help.
    Regards,
    FBELL
    *******************************Error Message**************************************************
    View Display Error
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 910, message: ORA-00910: specified length too long for its datatype at OCI call OCIStmtExecute: select distinct T38187.QUERY_TEXT as c1 from S_NQ_ACCT T38187 order by c1. [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: SELECT Topic."Logical SQL" saw_0 FROM "Usage Tracking" ORDER BY saw_0
    *******************************************************************************************

    I beleieve I have found the issue for at least one report.
    We have views in our production environment that call materialized views on another database via db link. They are generated nightly to reduce load for day-old reporting purposes on the Production server.
    I have found that the report in question uses a view with PRODUCT_DESCRIPTION. In the remote database, this is a VARCHAR2(1995 Bytes) column. However, when we create a view in our Production environment that simply calls this materialized view, it moves the length to VARCHAR2(4000).
    The oddest thing is that the longest string stored in the MV for that column is 71 characters long.
    I may be missing something here.... But the view that Discoverer created on the APPS side also has a column length for the PRODUCT_DESCRIPTION column of VARCHAR2(4000) and running the report manually returns results less than that - is this a possible bug?

  • Byte Order Mark for text file

    Dear all,
    I am currently working on ABAP development which create flat text file to client PC. Now the file may contain multi language, so the text encoding is UTF-8.
    My question is that I want to create UTF-8 file with BOM (Byte Order Mark).
    Is there a way to add that?
    Thanks a lot for your input in advance.
    Regards,
    Kazuya

    Hi,
    You can use the parameter WRITE_BOM of FM/method gui_download to do this.
    Kr,
    Manu.

  • Thumbnails for Nef files with upated exposure in Capture NX2 revert to original exposure

    I did a batch processing in Nikon Capture NX2 to update the exposure for all Nef files in a folder.
    When displayed in Bridge (CS6) the thumbnails at first show the thumbnail with the updated exposure, then slowly updates all the thumbnails to the original exposure.
    How do I get Bridge to display the thumbnails with the updated exposure and keep bridge from reverting back to the original exposure?

    You can set different default parameters for Adobe Camera RAW, but they are still default parameters and this is what Camera RAW uses to render the RAW file instead of the parameters saved in the RAW file by either the camera or Capture NX2. 
    The camera saves a low quality jpg image in the NEF file (you can't change this) and if you edit the NEF file with Capture NX2 or View NX2 it saves a high quality jpg image in the NEF file, which increases file size by a considerable amount. 
    I process everything from the RAW file using Photoshop CS6 Adobe Camera RAW.  I have all in camera parameters set to nominal, active D Lighting off, and use Camera Neutral with a custom tone curve that was generated using the Picture Control editor.  In Camera RAW I use Camera Neutral v4 with the same custom tone curve as I used in modification of the Picture control profile.  My Camera RAW default is set using the modified Camera Netural v4 profile and I get excellent agreemnet between the Camera jpg and Camera RAW. 

  • Flash Player for FLV files with alpha channel encoded

    My goal is to play the the transparent background flash video on the bottom right hand corner similar to the video on this website : http://www.dropshipblueprint.com/
    I already have the FLV file with alpha channel encoded.  I was made to understand I will need a special flash player that can read alpha channel in the flv file to make the background transparent? Is this correct? If yes, then how to accomplish this or where do I get that player, maybe opensourece player?  If the player is not a solution then how do I accomplish my end objective taking into consideration I have the FLV file with the alpha channel encoded.  Thanks for your help. Sam

    Sam,
    Welcome to the forum.
    Where do you need to play this "sprite" (the name for such a Flash video)?
    If you need to add that to a Video, then there could be a few challenges in PrE.
    If you need to add it to a Web site, then Flash Player (free from Adobe) should be able to display that.
    Can you please give us just a bit more info, on how you wish to use the sprite?
    Good luck,
    Hunt

Maybe you are looking for